mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
fix(migrations): create sign_sessions table before altering it
The catch-up migration assumed sign_sessions already existed, but databases created from older schema dumps may not have this table. Adding CREATE TABLE IF NOT EXISTS prevents the migration from failing with "relation does not exist" on those databases.
This commit is contained in:
@@ -17,6 +17,15 @@
|
|||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
-- Patch 00: psn-id (sign_sessions primary key + psn columns)
|
-- Patch 00: psn-id (sign_sessions primary key + psn columns)
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS public.sign_sessions (
|
||||||
|
id SERIAL PRIMARY KEY,
|
||||||
|
user_id integer,
|
||||||
|
char_id integer NOT NULL DEFAULT 0,
|
||||||
|
token character varying(16) NOT NULL,
|
||||||
|
server_id integer,
|
||||||
|
psn_id text
|
||||||
|
);
|
||||||
|
|
||||||
ALTER TABLE users ADD COLUMN IF NOT EXISTS psn_id TEXT;
|
ALTER TABLE users ADD COLUMN IF NOT EXISTS psn_id TEXT;
|
||||||
|
|
||||||
DO $$ BEGIN
|
DO $$ BEGIN
|
||||||
|
|||||||
Reference in New Issue
Block a user