Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(comments): cascade delete replies in DB when parent comment is deleted

Naiyuan Qing6cc8f7586af0
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 0000000000..ef56c144ff
--- /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 0000000000..986e686371
--- /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;