-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: constrain table to ensure at most one config can be active per kit
- Loading branch information
Showing
2 changed files
with
5 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
migrations/2024-03-21-205107_make-active-kit-configuration-partially-unique/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DROP INDEX ix_kit_configurations_active_kit_id |
4 changes: 4 additions & 0 deletions
4
migrations/2024-03-21-205107_make-active-kit-configuration-partially-unique/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE UNIQUE INDEX ix_kit_configurations_active_kit_id ON public.kit_configurations (kit_id) | ||
WHERE (active); | ||
|
||
COMMENT ON INDEX ix_kit_configurations_active_kit_id IS 'At most one kit configuration may be active per kit at any one time.' |