Update down.sql

This commit is contained in:
dullbananas 2024-06-05 07:59:55 -07:00 committed by GitHub
parent 8883f776c8
commit b7e8981d29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;