diff --git a/migrations/2024-06-05-134311_remove_redundant_post_id/down.sql b/migrations/2024-06-05-134311_remove_redundant_post_id/down.sql index 13fcacafb..9c25a4872 100644 --- a/migrations/2024-06-05-134311_remove_redundant_post_id/down.sql +++ b/migrations/2024-06-05-134311_remove_redundant_post_id/down.sql @@ -1,8 +1,8 @@ -ALTER TABLE comment_like +ALTER TABLE comment_actions ADD COLUMN post_id int REFERENCES post ON UPDATE CASCADE ON DELETE CASCADE; UPDATE - comment_like + comment_actions SET post_id = ( SELECT @@ -10,8 +10,7 @@ SET FROM comment WHERE - comment.id = comment_like.comment_id); - -ALTER TABLE comment_like - ALTER COLUMN post_id SET NOT NULL; + comment.id = comment_actions.comment_id) +WHERE + liked IS NOT NULL;