aboutsummaryrefslogtreecommitdiff
path: root/migrations/2024-08-16-230507_require_guild/up.sql
blob: 06e5cd3ff015f062bc071d3bcd0f8caf53fd9586 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- This migration will fail with any records in the db. If you are working with a normal server, you
-- can run:
--
-- $ convert_null_guilds --guild $PREVIOUS_SINGLETENANT_GUILD
--
-- to set all existing db records to the specified guild. A mixed / fucked up db sceneario will
-- require you to manually edit the db and ensure `guild` is set in `memes`, `invocation_records`,
-- and `tombstones`.

DO LANGUAGE plpgsql
$$
    BEGIN
        RAISE NOTICE 'if this migration fails, consider running "convert_null_guilds"';
    END
$$;

ALTER TABLE memes
    ALTER COLUMN guild SET NOT NULL;
ALTER TABLE invocation_records
    ALTER COLUMN guild SET NOT NULL;
ALTER TABLE tombstones
    ALTER COLUMN guild SET NOT NULL;