restore value of comment_like.post_id

This commit is contained in:
Felix Ableitner 2024-10-17 12:06:55 +02:00
parent 1a0770a0ef
commit 719efb28bc
4 changed files with 22 additions and 3 deletions

View file

@ -23,7 +23,7 @@ fi
--danger-dummy-mode \
--api-key "my-pictrs-key" \
filesystem -p /tmp/pictrs/files \
sled -p /tmp/pictrs/sled-repo 2>&1 &
sled -p /tmp/pictrs/sled-repo &
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
echo "DB URL: ${LEMMY_DATABASE_URL} INSTANCE: $INSTANCE"

View file

@ -11,7 +11,7 @@ killall -s1 lemmy_server || true
popd
pnpm i
pnpm api-test || true
pnpm api-test-image || true
killall -s1 lemmy_server || true
killall -s1 pict-rs || true

View file

@ -1,6 +1,23 @@
ALTER TABLE post_like
ADD COLUMN published timestamptz NOT NULL DEFAULT now();
ALTER TABLE comment_like
ADD COLUMN published timestamptz NOT NULL DEFAULT now();
ALTER TABLE comment_like
ADD COLUMN post_id int NOT NULL;
ADD COLUMN post_id int REFERENCES post ON UPDATE CASCADE ON DELETE CASCADE;
UPDATE
comment_like
SET
post_id = (
SELECT
post_id
FROM
comment
WHERE
comment.id = comment_like.comment_id);
ALTER TABLE comment_like
ALTER COLUMN post_id SET NOT NULL;

View file

@ -1,7 +1,9 @@
ALTER TABLE post_like
DROP published;
ALTER TABLE comment_like
DROP published;
ALTER TABLE comment_like
DROP post_id;