Multi-Column Unique Constraint in Directus App #13673
Replies: 4 comments
-
While the unique key has to be added manually, Directus shows a validation error when trying to save a record that fails:
I wonder if there is a way to translate the constraint name? |
Beta Was this translation helpful? Give feedback.
-
Also see #14158 |
Beta Was this translation helpful? Give feedback.
-
Heya! Thanks for opening this feature request! This feature request has received over 15 votes from the community. This means we'll move this feature request to the Under Review state! The Core team will schedule a meeting to review this request as soon as possible. The discussion will then be approved or denied. You may or may not be invited to join this meeting with the core team. For more information, see our Feature Request Process. |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
It would be nice to have a multiple column unique constraint for SQL tables that can be managed from within the Directus platform. At the minute, if using PostgreSQL, this has to be done by directly writing SQL query and executing it in the database. The query is
Having a UI for this would be a very usefull and this can be done in the Model page within the Settings Module similar to Duplication Field.
A UI can be built where the user can check multiple columns to be set as unique together. For an existing unique together constraint if the user unchecks a column then the constraint needs to be altered. Likewise, if user unchecks all checked columns then remove the unique together constraint. Unique together constraint does not need to exist with columns of related tables.
Beta Was this translation helpful? Give feedback.
All reactions