mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-09-14 11:35:50 -05:00
Database: Add upload timestamp to MKW ghost data
This commit is contained in:
@@ -30,10 +30,10 @@ const (
|
||||
"ORDER BY score DESC " +
|
||||
"LIMIT 1"
|
||||
insertGhostFileStatement = "" +
|
||||
"INSERT INTO mario_kart_wii_sake (regionid, courseid, score, pid, playerinfo, ghost) " +
|
||||
"VALUES ($1, $2, $3, $4, $5, $6) " +
|
||||
"INSERT INTO mario_kart_wii_sake (regionid, courseid, score, pid, playerinfo, ghost, upload_time) " +
|
||||
"VALUES ($1, $2, $3, $4, $5, $6, CURRENT_TIMESTAMP) " +
|
||||
"ON CONFLICT (courseid, pid) DO UPDATE " +
|
||||
"SET regionid = EXCLUDED.regionid, score = EXCLUDED.score, playerinfo = EXCLUDED.playerinfo, ghost = EXCLUDED.ghost"
|
||||
"SET regionid = EXCLUDED.regionid, score = EXCLUDED.score, playerinfo = EXCLUDED.playerinfo, ghost = EXCLUDED.ghost, upload_time = CURRENT_TIMESTAMP"
|
||||
)
|
||||
|
||||
func GetMarioKartWiiTopTenRankings(pool *pgxpool.Pool, ctx context.Context, regionId common.MarioKartWiiLeaderboardRegionId,
|
||||
|
||||
@@ -19,22 +19,14 @@ ALTER TABLE ONLY public.users
|
||||
ADD IF NOT EXISTS ban_reason_hidden character varying,
|
||||
ADD IF NOT EXISTS ban_moderator character varying,
|
||||
ADD IF NOT EXISTS ban_tos boolean,
|
||||
ADD IF NOT EXISTS open_host boolean DEFAULT false
|
||||
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)),
|
||||
pool.Exec(ctx, `
|
||||
|
||||
ALTER TABLE ONLY public.mario_kart_wii_sake
|
||||
ADD IF NOT EXISTS upload_time timestamp without time zone;
|
||||
|
||||
CONSTRAINT one_time_per_course_constraint UNIQUE (courseid, pid)
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.mario_kart_wii_sake OWNER TO wiilink;
|
||||
|
||||
`)
|
||||
`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user