-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from rfcx/feature/623-create-unique-constrain…
…t-between-detection_id-user_id-on-detection_reviews Add unique constraint to `detection_reviews` table
- Loading branch information
Showing
3 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
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
18 changes: 18 additions & 0 deletions
18
core/_cli/migrations/20240604172307-add-unique-constraint-to-detection-reviews.js
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,18 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
up: async (queryInterface) => { | ||
await queryInterface.sequelize.query(` | ||
ALTER TABLE | ||
"public"."detection_reviews" | ||
ADD CONSTRAINT detection_reviews_unique_detection_id_user_id_constraint UNIQUE (detection_id, user_id) | ||
`) | ||
}, | ||
down: async (queryInterface) => { | ||
await queryInterface.sequelize.query(` | ||
ALTER TABLE | ||
"public"."detection_reviews" | ||
DROP CONSTRAINT detection_reviews_unique_detection_id_user_id_constraint IF EXISTS | ||
`) | ||
} | ||
} |
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