From 719efb28bc35405a991bcba46a7b22929d7d514d Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 17 Oct 2024 12:06:55 +0200 Subject: [PATCH] restore value of comment_like.post_id --- api_tests/prepare-drone-federation-test.sh | 2 +- api_tests/run-federation-test.sh | 2 +- .../down.sql | 19 ++++++++++++++++++- .../up.sql | 2 ++ 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/api_tests/prepare-drone-federation-test.sh b/api_tests/prepare-drone-federation-test.sh index 65c4827d9..b17e2017e 100755 --- a/api_tests/prepare-drone-federation-test.sh +++ b/api_tests/prepare-drone-federation-test.sh @@ -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" diff --git a/api_tests/run-federation-test.sh b/api_tests/run-federation-test.sh index 969a95b3e..f9eab5039 100755 --- a/api_tests/run-federation-test.sh +++ b/api_tests/run-federation-test.sh @@ -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 diff --git a/migrations/2024-10-17-091053_vote-no-timestamp/down.sql b/migrations/2024-10-17-091053_vote-no-timestamp/down.sql index 0b2639913..928530641 100644 --- a/migrations/2024-10-17-091053_vote-no-timestamp/down.sql +++ b/migrations/2024-10-17-091053_vote-no-timestamp/down.sql @@ -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; + diff --git a/migrations/2024-10-17-091053_vote-no-timestamp/up.sql b/migrations/2024-10-17-091053_vote-no-timestamp/up.sql index 46dc48592..f094bdf5a 100644 --- a/migrations/2024-10-17-091053_vote-no-timestamp/up.sql +++ b/migrations/2024-10-17-091053_vote-no-timestamp/up.sql @@ -1,7 +1,9 @@ ALTER TABLE post_like DROP published; + ALTER TABLE comment_like DROP published; + ALTER TABLE comment_like DROP post_id;