This commit is contained in:
18
scripts/auth-catalog-migration.sql
Normal file
18
scripts/auth-catalog-migration.sql
Normal file
@@ -0,0 +1,18 @@
|
||||
-- Additive migration for the existing domain schema. No users or progress are removed.
|
||||
ALTER TABLE "user" ADD COLUMN IF NOT EXISTS role text NOT NULL DEFAULT 'user';
|
||||
ALTER TABLE account ADD COLUMN IF NOT EXISTS issuer text;
|
||||
-- Existing credentials use Better Auth's local namespace. Fail on unknown legacy
|
||||
-- OAuth providers rather than silently changing which remote identity they trust.
|
||||
UPDATE account SET issuer = 'local:credential' WHERE issuer IS NULL AND provider_id = 'credential';
|
||||
UPDATE account SET issuer = 'https://accounts.google.com' WHERE issuer IS NULL AND provider_id = 'google';
|
||||
UPDATE account SET issuer = 'local:oauth:github' WHERE issuer IS NULL AND provider_id = 'github';
|
||||
UPDATE account SET issuer = 'local:oauth:osu' WHERE issuer IS NULL AND provider_id = 'osu';
|
||||
ALTER TABLE account ALTER COLUMN issuer SET NOT NULL;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS account_issuer_account_id_unique ON account (issuer, account_id);
|
||||
ALTER TABLE games ADD COLUMN IF NOT EXISTS source_id integer;
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS games_source_id_unique ON games (source_id);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS pokemon_number_unique ON pokemon (number);
|
||||
ALTER TYPE availability ADD VALUE IF NOT EXISTS 'unknown';
|
||||
CREATE TABLE IF NOT EXISTS catch_em_all_settings (
|
||||
user_id text PRIMARY KEY REFERENCES "user"(id) ON DELETE CASCADE
|
||||
);
|
||||
Reference in New Issue
Block a user