Skip to content

Commit

Permalink
feat: sql migration
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrltrent committed Dec 21, 2023
1 parent 6ef98cb commit f138c1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions migrations/000062_award_constraints.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BEGIN;

-- Re-add the CHECK constraint
ALTER TABLE awards_general ADD CONSTRAINT awards_general_post_id_comment_id_check CHECK (
(post_id IS NOT NULL AND comment_id IS NULL) OR
(post_id IS NULL AND comment_id IS NOT NULL)
);

END;
6 changes: 6 additions & 0 deletions migrations/000062_award_constraints.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BEGIN;

-- Remove the CHECK constraint
ALTER TABLE awards_general DROP CONSTRAINT IF EXISTS awards_general_post_id_comment_id_check;

END;

0 comments on commit f138c1f

Please sign in to comment.