mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 11:13:51 +00:00
Throw error if the removed code_migrations.rs needed to run but didn't (#5723)
* Throw error if the removed code_migrations.rs needed to run but didn't * support postgresql 15 * improve error message --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
47111a8c6c
commit
9f425b8f42
2 changed files with 65 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
SELECT
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
-- https://github.com/LemmyNet/lemmy/pull/5710
|
||||||
|
-- Uncomment to test:
|
||||||
|
-- ALTER TABLE site DROP COLUMN instance_id; INSERT INTO site (name, public_key) VALUES ('', '');
|
||||||
|
DO $$
|
||||||
|
BEGIN
|
||||||
|
IF EXISTS (
|
||||||
|
SELECT
|
||||||
|
FROM ((
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
person
|
||||||
|
WHERE
|
||||||
|
ap_id LIKE 'http://changeme%'
|
||||||
|
OR (local
|
||||||
|
AND public_key = ''))
|
||||||
|
UNION ALL (
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
community
|
||||||
|
WHERE
|
||||||
|
ap_id LIKE 'http://changeme%'
|
||||||
|
OR (local
|
||||||
|
AND public_key = ''))
|
||||||
|
UNION ALL (
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
post
|
||||||
|
WHERE
|
||||||
|
thumbnail_url NOT LIKE 'http%'
|
||||||
|
OR (local
|
||||||
|
AND ap_id LIKE 'http://changeme%'))
|
||||||
|
UNION ALL (
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
comment
|
||||||
|
WHERE
|
||||||
|
ap_id LIKE 'http://changeme%'
|
||||||
|
AND local)
|
||||||
|
UNION ALL (
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
private_message
|
||||||
|
WHERE
|
||||||
|
ap_id LIKE 'http://changeme%'
|
||||||
|
AND local)
|
||||||
|
UNION ALL (
|
||||||
|
SELECT
|
||||||
|
id
|
||||||
|
FROM
|
||||||
|
site
|
||||||
|
WHERE
|
||||||
|
public_key = '')) AS broken_rows) THEN
|
||||||
|
RAISE 'Unstable upgrade: Youre on too old a version of lemmy. Upgrade to 0.19.0 first.';
|
||||||
|
END IF;
|
||||||
|
END
|
||||||
|
$$;
|
||||||
|
|
Loading…
Reference in a new issue