diff --git a/server/migrations/018_comment_parent_cascade.down.sql b/server/migrations/018_comment_parent_cascade.down.sql new file mode 100644 index 00000000..ef56c144 --- /dev/null +++ b/server/migrations/018_comment_parent_cascade.down.sql @@ -0,0 +1,3 @@ +ALTER TABLE comment DROP CONSTRAINT IF EXISTS comment_parent_id_fkey; +ALTER TABLE comment ADD CONSTRAINT comment_parent_id_fkey + FOREIGN KEY (parent_id) REFERENCES comment(id) ON DELETE SET NULL; diff --git a/server/migrations/018_comment_parent_cascade.up.sql b/server/migrations/018_comment_parent_cascade.up.sql new file mode 100644 index 00000000..986e6863 --- /dev/null +++ b/server/migrations/018_comment_parent_cascade.up.sql @@ -0,0 +1,3 @@ +ALTER TABLE comment DROP CONSTRAINT IF EXISTS comment_parent_id_fkey; +ALTER TABLE comment ADD CONSTRAINT comment_parent_id_fkey + FOREIGN KEY (parent_id) REFERENCES comment(id) ON DELETE CASCADE;