Add new tables to schema.go

This commit is contained in:
mkwcat
2024-09-06 11:33:51 -04:00
parent 833062264c
commit 70458273c9

View File

@@ -8,6 +8,7 @@ import (
func UpdateTables(pool *pgxpool.Pool, ctx context.Context) {
pool.Exec(ctx, `
ALTER TABLE ONLY public.users
ADD IF NOT EXISTS last_ip_address character varying DEFAULT ''::character varying,
ADD IF NOT EXISTS last_ingamesn character varying DEFAULT ''::character varying,
@@ -19,5 +20,21 @@ ALTER TABLE ONLY public.users
ADD IF NOT EXISTS ban_moderator character varying,
ADD IF NOT EXISTS ban_tos boolean,
ADD IF NOT EXISTS open_host boolean DEFAULT false
CREATE TABLE IF NOT EXISTS public.mario_kart_wii_sake (
regionid smallint NOT NULL CHECK (regionid >= 1 AND regionid <= 7),
courseid smallint NOT NULL CHECK (courseid >= 0 AND courseid <= 32767),
score integer NOT NULL CHECK (score > 0),
pid integer NOT NULL CHECK (pid > 0),
playerinfo varchar(108) NOT NULL CHECK (LENGTH(playerinfo) = 108),
ghost bytea CHECK (ghost IS NULL OR (OCTET_LENGTH(ghost) BETWEEN 148 AND 10240)),
CONSTRAINT one_time_per_course_constraint UNIQUE (courseid, pid)
);
ALTER TABLE public.mario_kart_wii_sake OWNER TO wiilink;
`)
}