diff --git a/README.md b/README.md index e54fac72..ad230a1a 100644 --- a/README.md +++ b/README.md @@ -928,7 +928,11 @@ streaks. A match counts once it has ended (the match in progress is on the live result (win, loss, draw) is read from the match's winner and final scores against the side the player played; a match with no winner and nobody scoring, or one abandoned by a restart, has no result. Playtime and seed time come from player sessions; kills per hour and cash per minute leave -seed time out; cash is summed over sessions, each banked across its matches like kills, so money +seed time out. They also leave out idle time, a player's time on in a match before any side had +scored (the match waiting for its players), so hours spent seeding are not counted as played on a +server without a Seeding reward; as both count the same wait, they leave out whichever of the two +is longer. Idle time is kept from this release on, so earlier matches have none. Cash +is summed over sessions, each banked across its matches like kills, so money spent in a match lowers it. Cash per minute divides that cash by the whole time of the sessions it came from: a session that began before a range or season counts all of its cash there, so all of its time too, though Playtime shows only the time inside. Names link to the dossier. diff --git a/drizzle/0051_idle_seconds.sql b/drizzle/0051_idle_seconds.sql new file mode 100644 index 00000000..dd0f7728 --- /dev/null +++ b/drizzle/0051_idle_seconds.sql @@ -0,0 +1,247 @@ +-- Idle time: of a player's time on in a match, the part before any side had scored, while the match +-- waited for its players (the game's MatchState.PreMatch.WaitingForPlayers). Kills per hour leaves +-- it out, as it leaves out seed time, so a player who seeds for hours before a match goes live is +-- not ranked as if those hours were played. The worker tallies it beside `seconds` (tallyLook); +-- lines written before this have 0, which is what they counted before. +-- +-- The totals and day rows carry the lines' sum like the other line columns. The functions below are +-- 0038's player_totals_recount and 0039's player_days_recount, player_lines_cleared, +-- player_totals_match_ended, player_days_rebuild and player_totals_rebuild, each with idle_seconds +-- added and nothing else changed. Every existing line has 0, so the rows need no rebuild: their 0 is already the sum. +ALTER TABLE "match_players" ADD COLUMN "idle_seconds" integer DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "player_days" ADD COLUMN "idle_seconds" bigint DEFAULT 0 NOT NULL;--> statement-breakpoint +ALTER TABLE "player_totals" ADD COLUMN "idle_seconds" bigint DEFAULT 0 NOT NULL;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_totals_recount"(sid text, pids text[]) RETURNS void LANGUAGE plpgsql AS $$ +BEGIN + PERFORM player_totals_lock(sid); + INSERT INTO player_totals AS t (server_id, steam_id, sessions, seconds, seed_seconds, cash, last_seen, + matches, kills, deaths, headshots, team_kills, suicides, vehicle_kills, + kill_streak, death_streak, wins, losses, draws, idle_seconds) + SELECT sid, p.steam_id, s.sessions, s.seconds, s.seed_seconds, s.cash, s.last_seen, + l.matches, l.kills, l.deaths, l.headshots, l.team_kills, l.suicides, l.vehicle_kills, + l.kill_streak, l.death_streak, l.wins, l.losses, l.draws, l.idle_seconds + FROM (SELECT DISTINCT unnest(pids) AS steam_id) p + CROSS JOIN LATERAL ( + SELECT COUNT(*)::int AS sessions, + COALESCE(SUM(EXTRACT(EPOCH FROM (ps.left_at - ps.joined_at))), 0) AS seconds, + COALESCE(SUM(ps.seed_seconds), 0) AS seed_seconds, COALESCE(SUM(ps.cash), 0) AS cash, + MAX(ps.last_seen) AS last_seen + FROM player_sessions ps + WHERE ps.steam_id = p.steam_id AND ps.server_id = sid AND ps.left_at IS NOT NULL) s + CROSS JOIN LATERAL ( + SELECT COUNT(*)::int AS matches, COALESCE(SUM(mp.kills), 0) AS kills, COALESCE(SUM(mp.deaths), 0) AS deaths, + COALESCE(SUM(mp.headshots), 0) AS headshots, COALESCE(SUM(mp.team_kills), 0) AS team_kills, + COALESCE(SUM(mp.suicides), 0) AS suicides, COALESCE(SUM(mp.vehicle_kills), 0) AS vehicle_kills, + COALESCE(MAX(mp.kill_streak), 0) AS kill_streak, COALESCE(MAX(mp.death_streak), 0) AS death_streak, + (COUNT(*) FILTER (WHERE x.r = 'win'))::int AS wins, + (COUNT(*) FILTER (WHERE x.r = 'loss'))::int AS losses, + (COUNT(*) FILTER (WHERE x.r = 'draw'))::int AS draws, + COALESCE(SUM(mp.idle_seconds), 0) AS idle_seconds + FROM match_players mp + JOIN matches m ON m.id = mp.match_id AND m.server_id = mp.server_id + CROSS JOIN LATERAL (SELECT match_result(m.final_scores, m.winner, mp.faction) AS r) x + WHERE mp.steam_id = p.steam_id AND mp.server_id = sid AND m.ended_at IS NOT NULL) l + ON CONFLICT (server_id, steam_id) DO UPDATE SET + sessions = EXCLUDED.sessions, seconds = EXCLUDED.seconds, seed_seconds = EXCLUDED.seed_seconds, + cash = EXCLUDED.cash, last_seen = EXCLUDED.last_seen, matches = EXCLUDED.matches, kills = EXCLUDED.kills, + deaths = EXCLUDED.deaths, headshots = EXCLUDED.headshots, team_kills = EXCLUDED.team_kills, + suicides = EXCLUDED.suicides, vehicle_kills = EXCLUDED.vehicle_kills, kill_streak = EXCLUDED.kill_streak, + death_streak = EXCLUDED.death_streak, wins = EXCLUDED.wins, losses = EXCLUDED.losses, draws = EXCLUDED.draws, + idle_seconds = EXCLUDED.idle_seconds; + DELETE FROM player_totals WHERE server_id = sid AND steam_id = ANY (pids) AND sessions = 0 AND matches = 0; +END $$;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_days_recount"(sid text, pids text[], days date[]) RETURNS void LANGUAGE plpgsql AS $$ +BEGIN + PERFORM player_totals_lock(sid); + INSERT INTO player_days AS t (server_id, day, steam_id, seconds, crossings, sessions, seed_seconds, cash, last_seen, + matches, kills, deaths, headshots, team_kills, suicides, vehicle_kills, + kill_streak, death_streak, wins, losses, draws, idle_seconds) + WITH k AS (SELECT DISTINCT u.p, u.d FROM unnest(pids, days) AS u(p, d) WHERE u.d IS NOT NULL), + c AS ( + SELECT DISTINCT ps.id, ps.steam_id, ps.joined_at, ps.left_at, ps.seed_seconds, ps.cash, ps.last_seen + FROM k JOIN player_sessions ps ON ps.steam_id = k.p AND ps.server_id = sid AND ps.left_at IS NOT NULL + AND ps.left_at >= k.d::timestamp AT TIME ZONE 'UTC' + AND LEAST(ps.joined_at, ps.left_at) < (k.d + 1)::timestamp AT TIME ZONE 'UTC'), + s AS ( + SELECT c.steam_id AS p, x.day AS d, SUM(x.seconds) AS seconds, + array_agg(c.joined_at ORDER BY c.joined_at) FILTER (WHERE x.crossing) AS crossings, + (COUNT(*) FILTER (WHERE x.closes))::int AS sessions, + COALESCE(SUM(c.seed_seconds) FILTER (WHERE x.closes), 0) AS seed_seconds, + COALESCE(SUM(c.cash) FILTER (WHERE x.closes), 0) AS cash, + MAX(c.last_seen) FILTER (WHERE x.closes) AS last_seen + FROM c CROSS JOIN LATERAL ( + SELECT p.day, p.seconds, p.crossing, p.day = (c.left_at AT TIME ZONE 'UTC')::date AS closes + FROM session_day_parts(c.joined_at, c.left_at) p) x + JOIN k ON k.p = c.steam_id AND k.d = x.day + GROUP BY 1, 2), + l AS ( + SELECT k.p, k.d, COUNT(*)::int AS matches, SUM(mp.kills) AS kills, SUM(mp.deaths) AS deaths, + SUM(mp.headshots) AS headshots, SUM(mp.team_kills) AS team_kills, SUM(mp.suicides) AS suicides, + SUM(mp.vehicle_kills) AS vehicle_kills, MAX(mp.kill_streak) AS kill_streak, + MAX(mp.death_streak) AS death_streak, + (COUNT(*) FILTER (WHERE x.r = 'win'))::int AS wins, + (COUNT(*) FILTER (WHERE x.r = 'loss'))::int AS losses, + (COUNT(*) FILTER (WHERE x.r = 'draw'))::int AS draws, + SUM(mp.idle_seconds) AS idle_seconds + FROM k JOIN match_players mp ON mp.steam_id = k.p AND mp.server_id = sid + JOIN matches m ON m.id = mp.match_id AND m.server_id = mp.server_id + AND m.ended_at >= k.d::timestamp AT TIME ZONE 'UTC' AND m.ended_at < (k.d + 1)::timestamp AT TIME ZONE 'UTC' + CROSS JOIN LATERAL (SELECT match_result(m.final_scores, m.winner, mp.faction) AS r) x + GROUP BY k.p, k.d) + SELECT sid, k.d, k.p, COALESCE(s.seconds, 0), s.crossings, COALESCE(s.sessions, 0), COALESCE(s.seed_seconds, 0), + COALESCE(s.cash, 0), s.last_seen, COALESCE(l.matches, 0), COALESCE(l.kills, 0), COALESCE(l.deaths, 0), + COALESCE(l.headshots, 0), COALESCE(l.team_kills, 0), COALESCE(l.suicides, 0), COALESCE(l.vehicle_kills, 0), + COALESCE(l.kill_streak, 0), COALESCE(l.death_streak, 0), COALESCE(l.wins, 0), COALESCE(l.losses, 0), + COALESCE(l.draws, 0), COALESCE(l.idle_seconds, 0) + FROM k LEFT JOIN s ON s.p = k.p AND s.d = k.d LEFT JOIN l ON l.p = k.p AND l.d = k.d + ON CONFLICT (server_id, day, steam_id) DO UPDATE SET + seconds = EXCLUDED.seconds, crossings = EXCLUDED.crossings, sessions = EXCLUDED.sessions, + seed_seconds = EXCLUDED.seed_seconds, cash = EXCLUDED.cash, last_seen = EXCLUDED.last_seen, + matches = EXCLUDED.matches, kills = EXCLUDED.kills, deaths = EXCLUDED.deaths, headshots = EXCLUDED.headshots, + team_kills = EXCLUDED.team_kills, suicides = EXCLUDED.suicides, vehicle_kills = EXCLUDED.vehicle_kills, + kill_streak = EXCLUDED.kill_streak, death_streak = EXCLUDED.death_streak, wins = EXCLUDED.wins, + losses = EXCLUDED.losses, draws = EXCLUDED.draws, idle_seconds = EXCLUDED.idle_seconds; + DELETE FROM player_days t USING (SELECT DISTINCT u.p, u.d FROM unnest(pids, days) AS u(p, d)) k + WHERE t.server_id = sid AND t.steam_id = k.p AND t.day = k.d + AND t.sessions = 0 AND t.matches = 0 AND t.seconds = 0 AND t.crossings IS NULL; +END $$;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_lines_cleared"(sid text) RETURNS void LANGUAGE plpgsql AS $$ +BEGIN + PERFORM player_totals_lock(sid); + UPDATE player_totals SET matches = 0, kills = 0, deaths = 0, headshots = 0, team_kills = 0, suicides = 0, + vehicle_kills = 0, kill_streak = 0, death_streak = 0, wins = 0, losses = 0, draws = 0, idle_seconds = 0 + WHERE server_id = sid AND matches > 0; + DELETE FROM player_totals WHERE server_id = sid AND sessions = 0 AND matches = 0; + UPDATE player_days SET matches = 0, kills = 0, deaths = 0, headshots = 0, team_kills = 0, suicides = 0, + vehicle_kills = 0, kill_streak = 0, death_streak = 0, wins = 0, losses = 0, draws = 0, idle_seconds = 0 + WHERE server_id = sid AND matches > 0; + DELETE FROM player_days + WHERE server_id = sid AND sessions = 0 AND matches = 0 AND seconds = 0 AND crossings IS NULL; +END $$;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_totals_match_ended"() RETURNS trigger LANGUAGE plpgsql AS $$ +BEGIN + PERFORM player_totals_lock(NEW.server_id); + INSERT INTO player_totals AS t (server_id, steam_id, matches, kills, deaths, headshots, team_kills, suicides, + vehicle_kills, kill_streak, death_streak, wins, losses, draws, idle_seconds) + SELECT mp.server_id, mp.steam_id, 1, mp.kills, mp.deaths, mp.headshots, mp.team_kills, mp.suicides, + mp.vehicle_kills, mp.kill_streak, mp.death_streak, + CASE WHEN x.r = 'win' THEN 1 ELSE 0 END, CASE WHEN x.r = 'loss' THEN 1 ELSE 0 END, + CASE WHEN x.r = 'draw' THEN 1 ELSE 0 END, mp.idle_seconds + FROM match_players mp + CROSS JOIN LATERAL (SELECT match_result(NEW.final_scores, NEW.winner, mp.faction) AS r) x + WHERE mp.match_id = NEW.id AND mp.server_id = NEW.server_id + ON CONFLICT (server_id, steam_id) DO UPDATE SET + matches = t.matches + EXCLUDED.matches, kills = t.kills + EXCLUDED.kills, deaths = t.deaths + EXCLUDED.deaths, + headshots = t.headshots + EXCLUDED.headshots, team_kills = t.team_kills + EXCLUDED.team_kills, + suicides = t.suicides + EXCLUDED.suicides, vehicle_kills = t.vehicle_kills + EXCLUDED.vehicle_kills, + kill_streak = CASE WHEN t.matches = 0 THEN EXCLUDED.kill_streak ELSE GREATEST(t.kill_streak, EXCLUDED.kill_streak) END, + death_streak = CASE WHEN t.matches = 0 THEN EXCLUDED.death_streak ELSE GREATEST(t.death_streak, EXCLUDED.death_streak) END, + wins = t.wins + EXCLUDED.wins, losses = t.losses + EXCLUDED.losses, draws = t.draws + EXCLUDED.draws, + idle_seconds = t.idle_seconds + EXCLUDED.idle_seconds; + INSERT INTO player_days AS t (server_id, day, steam_id, matches, kills, deaths, headshots, team_kills, suicides, + vehicle_kills, kill_streak, death_streak, wins, losses, draws, idle_seconds) + SELECT mp.server_id, (NEW.ended_at AT TIME ZONE 'UTC')::date, mp.steam_id, 1, mp.kills, mp.deaths, mp.headshots, + mp.team_kills, mp.suicides, mp.vehicle_kills, mp.kill_streak, mp.death_streak, + CASE WHEN x.r = 'win' THEN 1 ELSE 0 END, CASE WHEN x.r = 'loss' THEN 1 ELSE 0 END, + CASE WHEN x.r = 'draw' THEN 1 ELSE 0 END, mp.idle_seconds + FROM match_players mp + CROSS JOIN LATERAL (SELECT match_result(NEW.final_scores, NEW.winner, mp.faction) AS r) x + WHERE mp.match_id = NEW.id AND mp.server_id = NEW.server_id + ON CONFLICT (server_id, day, steam_id) DO UPDATE SET + matches = t.matches + EXCLUDED.matches, kills = t.kills + EXCLUDED.kills, deaths = t.deaths + EXCLUDED.deaths, + headshots = t.headshots + EXCLUDED.headshots, team_kills = t.team_kills + EXCLUDED.team_kills, + suicides = t.suicides + EXCLUDED.suicides, vehicle_kills = t.vehicle_kills + EXCLUDED.vehicle_kills, + kill_streak = CASE WHEN t.matches = 0 THEN EXCLUDED.kill_streak ELSE GREATEST(t.kill_streak, EXCLUDED.kill_streak) END, + death_streak = CASE WHEN t.matches = 0 THEN EXCLUDED.death_streak ELSE GREATEST(t.death_streak, EXCLUDED.death_streak) END, + wins = t.wins + EXCLUDED.wins, losses = t.losses + EXCLUDED.losses, draws = t.draws + EXCLUDED.draws, + idle_seconds = t.idle_seconds + EXCLUDED.idle_seconds; + RETURN NEW; +END $$;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_days_rebuild"() RETURNS void LANGUAGE plpgsql AS $$ +BEGIN + IF EXISTS (SELECT 1 FROM player_sessions WHERE left_at IS NOT NULL AND last_seen IS DISTINCT FROM left_at) THEN + RAISE EXCEPTION 'a closed player session must have last_seen equal to left_at (migration 0039): player_days not built'; + END IF; + DELETE FROM player_days; + INSERT INTO player_days (server_id, day, steam_id, seconds, crossings, sessions, seed_seconds, cash, last_seen, + matches, kills, deaths, headshots, team_kills, suicides, vehicle_kills, + kill_streak, death_streak, wins, losses, draws, idle_seconds) + WITH results AS ( + SELECT f.match_id, f.faction, match_result(m.final_scores, m.winner, f.faction) AS r + FROM (SELECT DISTINCT match_id, faction FROM match_players WHERE faction IS NOT NULL) f + JOIN matches m ON m.id = f.match_id + WHERE m.ended_at IS NOT NULL), + s AS ( + SELECT ps.server_id, x.day, ps.steam_id, SUM(x.seconds) AS seconds, + array_agg(ps.joined_at ORDER BY ps.joined_at) FILTER (WHERE x.crossing) AS crossings, + (COUNT(*) FILTER (WHERE x.closes))::int AS sessions, + COALESCE(SUM(ps.seed_seconds) FILTER (WHERE x.closes), 0) AS seed_seconds, + COALESCE(SUM(ps.cash) FILTER (WHERE x.closes), 0) AS cash, + MAX(ps.last_seen) FILTER (WHERE x.closes) AS last_seen + FROM player_sessions ps CROSS JOIN LATERAL ( + SELECT p.day, p.seconds, p.crossing, p.day = (ps.left_at AT TIME ZONE 'UTC')::date AS closes + FROM session_day_parts(ps.joined_at, ps.left_at) p) x + WHERE ps.left_at IS NOT NULL + GROUP BY 1, 2, 3), + l AS ( + SELECT mp.server_id, (m.ended_at AT TIME ZONE 'UTC')::date AS day, mp.steam_id, COUNT(*)::int AS matches, + SUM(mp.kills) AS kills, SUM(mp.deaths) AS deaths, SUM(mp.headshots) AS headshots, + SUM(mp.team_kills) AS team_kills, SUM(mp.suicides) AS suicides, SUM(mp.vehicle_kills) AS vehicle_kills, + MAX(mp.kill_streak) AS kill_streak, MAX(mp.death_streak) AS death_streak, + (COUNT(*) FILTER (WHERE x.r = 'win'))::int AS wins, + (COUNT(*) FILTER (WHERE x.r = 'loss'))::int AS losses, + (COUNT(*) FILTER (WHERE x.r = 'draw'))::int AS draws, + SUM(mp.idle_seconds) AS idle_seconds + FROM match_players mp + JOIN matches m ON m.id = mp.match_id AND m.server_id = mp.server_id + LEFT JOIN results x ON x.match_id = mp.match_id AND x.faction = mp.faction + WHERE m.ended_at IS NOT NULL + GROUP BY 1, 2, 3) + SELECT COALESCE(s.server_id, l.server_id), COALESCE(s.day, l.day), COALESCE(s.steam_id, l.steam_id), + COALESCE(s.seconds, 0), s.crossings, COALESCE(s.sessions, 0), COALESCE(s.seed_seconds, 0), + COALESCE(s.cash, 0), s.last_seen, COALESCE(l.matches, 0), COALESCE(l.kills, 0), COALESCE(l.deaths, 0), + COALESCE(l.headshots, 0), COALESCE(l.team_kills, 0), COALESCE(l.suicides, 0), COALESCE(l.vehicle_kills, 0), + COALESCE(l.kill_streak, 0), COALESCE(l.death_streak, 0), COALESCE(l.wins, 0), COALESCE(l.losses, 0), + COALESCE(l.draws, 0), COALESCE(l.idle_seconds, 0) + FROM s FULL JOIN l ON l.server_id = s.server_id AND l.day = s.day AND l.steam_id = s.steam_id; +END $$;--> statement-breakpoint +CREATE OR REPLACE FUNCTION "player_totals_rebuild"() RETURNS void LANGUAGE plpgsql AS $$ +BEGIN + DELETE FROM player_totals; + INSERT INTO player_totals (server_id, steam_id, sessions, seconds, seed_seconds, cash, last_seen, + matches, kills, deaths, headshots, team_kills, suicides, vehicle_kills, + kill_streak, death_streak, wins, losses, draws, idle_seconds) + WITH results AS ( + SELECT f.match_id, f.faction, match_result(m.final_scores, m.winner, f.faction) AS r + FROM (SELECT DISTINCT match_id, faction FROM match_players WHERE faction IS NOT NULL) f + JOIN matches m ON m.id = f.match_id + WHERE m.ended_at IS NOT NULL), + s AS ( + SELECT server_id, steam_id, COUNT(*)::int AS sessions, + SUM(EXTRACT(EPOCH FROM (left_at - joined_at))) AS seconds, + SUM(seed_seconds) AS seed_seconds, SUM(cash) AS cash, MAX(last_seen) AS last_seen + FROM player_sessions WHERE left_at IS NOT NULL + GROUP BY server_id, steam_id), + l AS ( + SELECT mp.server_id, mp.steam_id, COUNT(*)::int AS matches, SUM(mp.kills) AS kills, SUM(mp.deaths) AS deaths, + SUM(mp.headshots) AS headshots, SUM(mp.team_kills) AS team_kills, SUM(mp.suicides) AS suicides, + SUM(mp.vehicle_kills) AS vehicle_kills, MAX(mp.kill_streak) AS kill_streak, + MAX(mp.death_streak) AS death_streak, + (COUNT(*) FILTER (WHERE x.r = 'win'))::int AS wins, + (COUNT(*) FILTER (WHERE x.r = 'loss'))::int AS losses, + (COUNT(*) FILTER (WHERE x.r = 'draw'))::int AS draws, + SUM(mp.idle_seconds) AS idle_seconds + FROM match_players mp + JOIN matches m ON m.id = mp.match_id AND m.server_id = mp.server_id + LEFT JOIN results x ON x.match_id = mp.match_id AND x.faction = mp.faction + WHERE m.ended_at IS NOT NULL + GROUP BY mp.server_id, mp.steam_id) + SELECT COALESCE(s.server_id, l.server_id), COALESCE(s.steam_id, l.steam_id), + COALESCE(s.sessions, 0), COALESCE(s.seconds, 0), COALESCE(s.seed_seconds, 0), COALESCE(s.cash, 0), s.last_seen, + COALESCE(l.matches, 0), COALESCE(l.kills, 0), COALESCE(l.deaths, 0), COALESCE(l.headshots, 0), + COALESCE(l.team_kills, 0), COALESCE(l.suicides, 0), COALESCE(l.vehicle_kills, 0), + COALESCE(l.kill_streak, 0), COALESCE(l.death_streak, 0), + COALESCE(l.wins, 0), COALESCE(l.losses, 0), COALESCE(l.draws, 0), COALESCE(l.idle_seconds, 0) + FROM s FULL JOIN l ON l.server_id = s.server_id AND l.steam_id = s.steam_id; + PERFORM player_days_rebuild(); +END $$; diff --git a/drizzle/meta/0051_snapshot.json b/drizzle/meta/0051_snapshot.json new file mode 100644 index 00000000..b8e33ab5 --- /dev/null +++ b/drizzle/meta/0051_snapshot.json @@ -0,0 +1,5761 @@ +{ + "id": "09975601-4e40-44ca-9753-6e9a8b2cd387", + "prevId": "9de65adc-6a94-4870-a19b-b960ffed63ae", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "issuer": { + "name": "issuer", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": { + "account_user_id_idx": { + "name": "account_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "account_issuer_account_id_uidx": { + "name": "account_issuer_account_id_uidx", + "columns": [ + { + "expression": "issuer", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "account_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.api_keys": { + "name": "api_keys", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "key_hash": { + "name": "key_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "hint": { + "name": "hint", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "capabilities": { + "name": "capabilities", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "server_ids": { + "name": "server_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "last_used_at": { + "name": "last_used_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "api_keys_org_idx": { + "name": "api_keys_org_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "api_keys_org_id_organizations_id_fk": { + "name": "api_keys_org_id_organizations_id_fk", + "tableFrom": "api_keys", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "api_keys_created_by_user_id_fk": { + "name": "api_keys_created_by_user_id_fk", + "tableFrom": "api_keys", + "tableTo": "user", + "columnsFrom": [ + "created_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "api_keys_key_hash_unique": { + "name": "api_keys_key_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "key_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.audit_log": { + "name": "audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "ts": { + "name": "ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "actor_id": { + "name": "actor_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "actor_name": { + "name": "actor_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "server_name": { + "name": "server_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "category": { + "name": "category", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "target": { + "name": "target", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "detail": { + "name": "detail", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "audit_ts_idx": { + "name": "audit_ts_idx", + "columns": [ + { + "expression": "ts", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_server_idx": { + "name": "audit_server_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_org_idx": { + "name": "audit_org_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_actor_idx": { + "name": "audit_actor_idx", + "columns": [ + { + "expression": "actor_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_action_idx": { + "name": "audit_action_idx", + "columns": [ + { + "expression": "category", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "action", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "audit_target_idx": { + "name": "audit_target_idx", + "columns": [ + { + "expression": "target", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"audit_log\".\"target\" <> ''", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.json_webhook_posts": { + "name": "json_webhook_posts", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "webhook_id": { + "name": "webhook_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "not_before": { + "name": "not_before", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "lease_until": { + "name": "lease_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "done_at": { + "name": "done_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "json_webhook_posts_event_idx": { + "name": "json_webhook_posts_event_idx", + "columns": [ + { + "expression": "webhook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "json_webhook_posts_next_idx": { + "name": "json_webhook_posts_next_idx", + "columns": [ + { + "expression": "webhook_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"json_webhook_posts\".\"state\" in ('pending', 'sending')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "json_webhook_posts_open_idx": { + "name": "json_webhook_posts_open_idx", + "columns": [ + { + "expression": "state", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"json_webhook_posts\".\"state\" in ('pending', 'sending')", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "json_webhook_posts_webhook_id_json_webhooks_id_fk": { + "name": "json_webhook_posts_webhook_id_json_webhooks_id_fk", + "tableFrom": "json_webhook_posts", + "tableTo": "json_webhooks", + "columnsFrom": [ + "webhook_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.json_webhooks": { + "name": "json_webhooks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "url_enc": { + "name": "url_enc", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url_hint": { + "name": "url_hint", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "secret_enc": { + "name": "secret_enc", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "events": { + "name": "events", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "server_ids": { + "name": "server_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "allow_private": { + "name": "allow_private", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_sent_at": { + "name": "last_sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_status": { + "name": "last_status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "json_webhooks_org_idx": { + "name": "json_webhooks_org_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "json_webhooks_org_id_organizations_id_fk": { + "name": "json_webhooks_org_id_organizations_id_fk", + "tableFrom": "json_webhooks", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.kills": { + "name": "kills", + "schema": "", + "columns": { + "ts": { + "name": "ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "match_id": { + "name": "match_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "match_row": { + "name": "match_row", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "event_time": { + "name": "event_time", + "type": "real", + "primaryKey": false, + "notNull": true + }, + "map": { + "name": "map", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "killer_steam_id": { + "name": "killer_steam_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "killer_name": { + "name": "killer_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "killer_faction": { + "name": "killer_faction", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "victim_steam_id": { + "name": "victim_steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "victim_name": { + "name": "victim_name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "victim_faction": { + "name": "victim_faction", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "cause": { + "name": "cause", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "distance_m": { + "name": "distance_m", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "headshot": { + "name": "headshot", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "suicide": { + "name": "suicide", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "team_kill": { + "name": "team_kill", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "tags": { + "name": "tags", + "type": "jsonb", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "kills_event_idx": { + "name": "kills_event_idx", + "columns": [ + { + "expression": "event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kills_server_ts_idx": { + "name": "kills_server_ts_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ts", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kills_killer_idx": { + "name": "kills_killer_idx", + "columns": [ + { + "expression": "killer_steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ts", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "kills_victim_idx": { + "name": "kills_victim_idx", + "columns": [ + { + "expression": "victim_steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ts", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.list_entries": { + "name": "list_entries", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "added_by": { + "name": "added_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "added_by_name": { + "name": "added_by_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "added_at": { + "name": "added_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "removed_at": { + "name": "removed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "removed_by": { + "name": "removed_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "removed_by_name": { + "name": "removed_by_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "removal": { + "name": "removal", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "list_entries_active_uidx": { + "name": "list_entries_active_uidx", + "columns": [ + { + "expression": "list_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"list_entries\".\"removed_at\" is null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "list_entries_list_idx": { + "name": "list_entries_list_idx", + "columns": [ + { + "expression": "list_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "removed_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "list_entries_steam_idx": { + "name": "list_entries_steam_idx", + "columns": [ + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "list_entries_expiry_idx": { + "name": "list_entries_expiry_idx", + "columns": [ + { + "expression": "expires_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"list_entries\".\"removed_at\" is null and \"list_entries\".\"expires_at\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "list_entries_list_id_lists_id_fk": { + "name": "list_entries_list_id_lists_id_fk", + "tableFrom": "list_entries", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lists": { + "name": "lists", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'Default'" + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "on_from": { + "name": "on_from", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "on_until": { + "name": "on_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "every_server": { + "name": "every_server", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "archived_at": { + "name": "archived_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "share_token": { + "name": "share_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "lists_org_kind_name_uidx": { + "name": "lists_org_kind_name_uidx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"name\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"lists\".\"server_id\" is null and \"lists\".\"archived_at\" is null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "lists_org_default_uidx": { + "name": "lists_org_default_uidx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"lists\".\"is_default\"", + "concurrently": false, + "method": "btree", + "with": {} + }, + "lists_server_kind_uidx": { + "name": "lists_server_kind_uidx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "kind", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"lists\".\"server_id\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "lists_org_id_organizations_id_fk": { + "name": "lists_org_id_organizations_id_fk", + "tableFrom": "lists", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "lists_server_id_servers_id_fk": { + "name": "lists_server_id_servers_id_fk", + "tableFrom": "lists", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "lists_share_token_unique": { + "name": "lists_share_token_unique", + "nullsNotDistinct": false, + "columns": [ + "share_token" + ] + } + }, + "policies": {}, + "checkConstraints": { + "lists_group_kind": { + "name": "lists_group_kind", + "value": "\"lists\".\"server_id\" is not null or \"lists\".\"is_default\" or \"lists\".\"kind\" = 'reserve'" + }, + "lists_group_shape": { + "name": "lists_group_shape", + "value": "(\"lists\".\"server_id\" is null and not \"lists\".\"is_default\") or (\"lists\".\"on_from\" is null and \"lists\".\"on_until\" is null and \"lists\".\"every_server\" and \"lists\".\"archived_at\" is null)" + }, + "lists_window": { + "name": "lists_window", + "value": "\"lists\".\"on_from\" is null or \"lists\".\"on_until\" is null or \"lists\".\"on_from\" < \"lists\".\"on_until\"" + } + }, + "isRLSEnabled": false + }, + "public.login_attempts": { + "name": "login_attempts", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "count": { + "name": "count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "first_at": { + "name": "first_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.match_events": { + "name": "match_events", + "schema": "", + "columns": { + "ts": { + "name": "ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_id": { + "name": "event_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "seq": { + "name": "seq", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "instance_id": { + "name": "instance_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "type": { + "name": "type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "event_time": { + "name": "event_time", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "match_id": { + "name": "match_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "map": { + "name": "map", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "players": { + "name": "players", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "winning_faction": { + "name": "winning_faction", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scores": { + "name": "scores", + "type": "jsonb", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "match_events_event_idx": { + "name": "match_events_event_idx", + "columns": [ + { + "expression": "event_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "match_events_server_ts_idx": { + "name": "match_events_server_ts_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ts", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.match_players": { + "name": "match_players", + "schema": "", + "columns": { + "match_id": { + "name": "match_id", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "faction": { + "name": "faction", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "seconds": { + "name": "seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kills": { + "name": "kills", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "deaths": { + "name": "deaths", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cash_delta": { + "name": "cash_delta", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "headshots": { + "name": "headshots", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "team_kills": { + "name": "team_kills", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "suicides": { + "name": "suicides", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "vehicle_kills": { + "name": "vehicle_kills", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "longest_m": { + "name": "longest_m", + "type": "real", + "primaryKey": false, + "notNull": false + }, + "kill_streak": { + "name": "kill_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "death_streak": { + "name": "death_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "idle_seconds": { + "name": "idle_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "match_players_server_idx": { + "name": "match_players_server_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "match_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "match_players_steam_idx": { + "name": "match_players_steam_idx", + "columns": [ + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "match_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "match_players_match_id_steam_id_pk": { + "name": "match_players_match_id_steam_id_pk", + "columns": [ + "match_id", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.matches": { + "name": "matches", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "ended_at": { + "name": "ended_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "map": { + "name": "map", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "experiences": { + "name": "experiences", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lighting": { + "name": "lighting", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "peak_players": { + "name": "peak_players", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "final_scores": { + "name": "final_scores", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "winner": { + "name": "winner", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "matches_server_idx": { + "name": "matches_server_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "started_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "matches_open_idx": { + "name": "matches_open_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"matches\".\"ended_at\" is null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "matches_server_ended_idx": { + "name": "matches_server_ended_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ended_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_ban_reasons": { + "name": "org_ban_reasons", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "reasons": { + "name": "reasons", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "org_ban_reasons_org_id_organizations_id_fk": { + "name": "org_ban_reasons_org_id_organizations_id_fk", + "tableFrom": "org_ban_reasons", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_invites": { + "name": "org_invites", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "org_role": { + "name": "org_role", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'member'" + }, + "server_role_id": { + "name": "server_role_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "max_uses": { + "name": "max_uses", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "uses": { + "name": "uses", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "revoked_at": { + "name": "revoked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_invites_org_idx": { + "name": "org_invites_org_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "org_invites_org_id_organizations_id_fk": { + "name": "org_invites_org_id_organizations_id_fk", + "tableFrom": "org_invites", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "org_invites_server_role_id_org_roles_id_fk": { + "name": "org_invites_server_role_id_org_roles_id_fk", + "tableFrom": "org_invites", + "tableTo": "org_roles", + "columnsFrom": [ + "server_role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "org_invites_token_unique": { + "name": "org_invites_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_members": { + "name": "org_members", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "invite_id": { + "name": "invite_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_members_user_idx": { + "name": "org_members_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "org_members_org_id_organizations_id_fk": { + "name": "org_members_org_id_organizations_id_fk", + "tableFrom": "org_members", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "org_members_user_id_user_id_fk": { + "name": "org_members_user_id_user_id_fk", + "tableFrom": "org_members", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "org_members_org_id_user_id_pk": { + "name": "org_members_org_id_user_id_pk", + "columns": [ + "org_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_roles": { + "name": "org_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "capabilities": { + "name": "capabilities", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "builtin": { + "name": "builtin", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "org_roles_builtin_uidx": { + "name": "org_roles_builtin_uidx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "builtin", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "where": "\"org_roles\".\"builtin\" is not null", + "concurrently": false, + "method": "btree", + "with": {} + }, + "org_roles_name_uidx": { + "name": "org_roles_name_uidx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "lower(\"name\")", + "asc": true, + "isExpression": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "org_roles_org_id_organizations_id_fk": { + "name": "org_roles_org_id_organizations_id_fk", + "tableFrom": "org_roles", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.org_saved_messages": { + "name": "org_saved_messages", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "messages": { + "name": "messages", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "org_saved_messages_org_id_organizations_id_fk": { + "name": "org_saved_messages_org_id_organizations_id_fk", + "tableFrom": "org_saved_messages", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "org_saved_messages_updated_by_user_id_fk": { + "name": "org_saved_messages_updated_by_user_id_fk", + "tableFrom": "org_saved_messages", + "tableTo": "user", + "columnsFrom": [ + "updated_by" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.organizations": { + "name": "organizations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "slug": { + "name": "slug", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "server_limit": { + "name": "server_limit", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "suspended_at": { + "name": "suspended_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "suspended_reason": { + "name": "suspended_reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "members_reserved": { + "name": "members_reserved", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "allow_public_status": { + "name": "allow_public_status", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "allow_public_leaderboards": { + "name": "allow_public_leaderboards", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "discord_invite_url": { + "name": "discord_invite_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "ban_message": { + "name": "ban_message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'{reason}'" + }, + "board_opens": { + "name": "board_opens", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'official'" + }, + "board_hidden": { + "name": "board_hidden", + "type": "text[]", + "primaryKey": false, + "notNull": true, + "default": "'{}'::text[]" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "organizations_slug_unique": { + "name": "organizations_slug_unique", + "nullsNotDistinct": false, + "columns": [ + "slug" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.outbox": { + "name": "outbox", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "trigger_id": { + "name": "trigger_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "trigger_name": { + "name": "trigger_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "trigger_kind": { + "name": "trigger_kind", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "action": { + "name": "action", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "params": { + "name": "params", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "target": { + "name": "target", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "detail": { + "name": "detail", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ok_message": { + "name": "ok_message", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "dedupe_key": { + "name": "dedupe_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'pending'" + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "not_before": { + "name": "not_before", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "lease_until": { + "name": "lease_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "outcome": { + "name": "outcome", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "done_at": { + "name": "done_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "outbox_dedupe_idx": { + "name": "outbox_dedupe_idx", + "columns": [ + { + "expression": "dedupe_key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_pending_idx": { + "name": "outbox_pending_idx", + "columns": [ + { + "expression": "state", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "not_before", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "where": "\"outbox\".\"state\" in ('pending', 'sending')", + "concurrently": false, + "method": "btree", + "with": {} + }, + "outbox_server_idx": { + "name": "outbox_server_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "created_at", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "outbox_server_id_servers_id_fk": { + "name": "outbox_server_id_servers_id_fk", + "tableFrom": "outbox", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.passkey": { + "name": "passkey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "credential_id": { + "name": "credential_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "counter": { + "name": "counter", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "device_type": { + "name": "device_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backed_up": { + "name": "backed_up", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "transports": { + "name": "transports", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "aaguid": { + "name": "aaguid", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "passkey_user_id_idx": { + "name": "passkey_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "passkey_credential_id_idx": { + "name": "passkey_credential_id_idx", + "columns": [ + { + "expression": "credential_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "passkey_user_id_user_id_fk": { + "name": "passkey_user_id_user_id_fk", + "tableFrom": "passkey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_aliases": { + "name": "player_aliases", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "holder": { + "name": "holder", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "first_seen": { + "name": "first_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "player_aliases_steam_idx": { + "name": "player_aliases_steam_idx", + "columns": [ + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": { + "player_aliases_server_id_steam_id_name_pk": { + "name": "player_aliases_server_id_steam_id_name_pk", + "columns": [ + "server_id", + "steam_id", + "name" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_days": { + "name": "player_days", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "day": { + "name": "day", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "seconds": { + "name": "seconds", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "crossings": { + "name": "crossings", + "type": "timestamp with time zone[]", + "primaryKey": false, + "notNull": false + }, + "sessions": { + "name": "sessions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "seed_seconds": { + "name": "seed_seconds", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cash": { + "name": "cash", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "matches": { + "name": "matches", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kills": { + "name": "kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "deaths": { + "name": "deaths", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "headshots": { + "name": "headshots", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "team_kills": { + "name": "team_kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "suicides": { + "name": "suicides", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "vehicle_kills": { + "name": "vehicle_kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kill_streak": { + "name": "kill_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "death_streak": { + "name": "death_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "wins": { + "name": "wins", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "losses": { + "name": "losses", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "draws": { + "name": "draws", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "idle_seconds": { + "name": "idle_seconds", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "player_days_server_id_day_steam_id_pk": { + "name": "player_days_server_id_day_steam_id_pk", + "columns": [ + "server_id", + "day", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_marks": { + "name": "player_marks", + "schema": "", + "columns": { + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "watched": { + "name": "watched", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "updated_by_name": { + "name": "updated_by_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "player_marks_org_id_organizations_id_fk": { + "name": "player_marks_org_id_organizations_id_fk", + "tableFrom": "player_marks", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "player_marks_org_id_steam_id_pk": { + "name": "player_marks_org_id_steam_id_pk", + "columns": [ + "org_id", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_notes": { + "name": "player_notes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "author_id": { + "name": "author_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "author_name": { + "name": "author_name", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "body": { + "name": "body", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "player_notes_idx": { + "name": "player_notes_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "player_notes_org_id_organizations_id_fk": { + "name": "player_notes_org_id_organizations_id_fk", + "tableFrom": "player_notes", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_sessions": { + "name": "player_sessions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "bigserial", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "faction": { + "name": "faction", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "joined_at": { + "name": "joined_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "left_at": { + "name": "left_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "kills": { + "name": "kills", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "deaths": { + "name": "deaths", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cash": { + "name": "cash", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "seed_seconds": { + "name": "seed_seconds", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": { + "player_sessions_open_idx": { + "name": "player_sessions_open_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "left_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "player_sessions_steam_idx": { + "name": "player_sessions_steam_idx", + "columns": [ + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "joined_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.player_totals": { + "name": "player_totals", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "sessions": { + "name": "sessions", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "seconds": { + "name": "seconds", + "type": "numeric", + "primaryKey": false, + "notNull": true, + "default": "'0'" + }, + "seed_seconds": { + "name": "seed_seconds", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "cash": { + "name": "cash", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "last_seen": { + "name": "last_seen", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "matches": { + "name": "matches", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kills": { + "name": "kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "deaths": { + "name": "deaths", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "headshots": { + "name": "headshots", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "team_kills": { + "name": "team_kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "suicides": { + "name": "suicides", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "vehicle_kills": { + "name": "vehicle_kills", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "kill_streak": { + "name": "kill_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "death_streak": { + "name": "death_streak", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "wins": { + "name": "wins", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "losses": { + "name": "losses", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "draws": { + "name": "draws", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "idle_seconds": { + "name": "idle_seconds", + "type": "bigint", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "player_totals_server_id_steam_id_pk": { + "name": "player_totals_server_id_steam_id_pk", + "columns": [ + "server_id", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sample_map_rollups": { + "name": "sample_map_rollups", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bucket": { + "name": "bucket", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "map": { + "name": "map", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "secs": { + "name": "secs", + "type": "real", + "primaryKey": false, + "notNull": true, + "default": 0 + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sample_map_rollups_server_id_bucket_map_pk": { + "name": "sample_map_rollups_server_id_bucket_map_pk", + "columns": [ + "server_id", + "bucket", + "map" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.sample_rollups": { + "name": "sample_rollups", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "bucket": { + "name": "bucket", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "samples": { + "name": "samples", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "ok_samples": { + "name": "ok_samples", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "up_s": { + "name": "up_s", + "type": "real", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "down_s": { + "name": "down_s", + "type": "real", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "player_s": { + "name": "player_s", + "type": "real", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "max_players": { + "name": "max_players", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "max_cap": { + "name": "max_cap", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": { + "sample_rollups_server_id_bucket_pk": { + "name": "sample_rollups_server_id_bucket_pk", + "columns": [ + "server_id", + "bucket" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.samples": { + "name": "samples", + "schema": "", + "columns": { + "ts": { + "name": "ts", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ok": { + "name": "ok", + "type": "boolean", + "primaryKey": false, + "notNull": true + }, + "player_count": { + "name": "player_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "max_players": { + "name": "max_players", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "map": { + "name": "map", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "experiences": { + "name": "experiences", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lighting": { + "name": "lighting", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "match_seconds": { + "name": "match_seconds", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "scores": { + "name": "scores", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "cash": { + "name": "cash", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "latency_ms": { + "name": "latency_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "samples_server_ts_idx": { + "name": "samples_server_ts_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "ts", + "isExpression": false, + "asc": false, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.seasons": { + "name": "seasons", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "starts_at": { + "name": "starts_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "seasons_org_start_uidx": { + "name": "seasons_org_start_uidx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "starts_at", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "seasons_org_id_organizations_id_fk": { + "name": "seasons_org_id_organizations_id_fk", + "tableFrom": "seasons", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_bans": { + "name": "server_bans", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "reason": { + "name": "reason", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "banned_by": { + "name": "banned_by", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "banned_at_utc": { + "name": "banned_at_utc", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "server_bans_steam_idx": { + "name": "server_bans_steam_idx", + "columns": [ + { + "expression": "steam_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "server_bans_server_id_servers_id_fk": { + "name": "server_bans_server_id_servers_id_fk", + "tableFrom": "server_bans", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "server_bans_server_id_steam_id_pk": { + "name": "server_bans_server_id_steam_id_pk", + "columns": [ + "server_id", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_grants": { + "name": "server_grants", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "granted_by": { + "name": "granted_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "server_grants_user_idx": { + "name": "server_grants_user_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "server_grants_role_idx": { + "name": "server_grants_role_idx", + "columns": [ + { + "expression": "role_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "server_grants_server_id_servers_id_fk": { + "name": "server_grants_server_id_servers_id_fk", + "tableFrom": "server_grants", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "server_grants_user_id_user_id_fk": { + "name": "server_grants_user_id_user_id_fk", + "tableFrom": "server_grants", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "server_grants_role_id_org_roles_id_fk": { + "name": "server_grants_role_id_org_roles_id_fk", + "tableFrom": "server_grants", + "tableTo": "org_roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "restrict", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "server_grants_server_id_user_id_pk": { + "name": "server_grants_server_id_user_id_pk", + "columns": [ + "server_id", + "user_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_list_state": { + "name": "server_list_state", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "source_list_id": { + "name": "source_list_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "attempted_at": { + "name": "attempted_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "server_list_state_source_idx": { + "name": "server_list_state_source_idx", + "columns": [ + { + "expression": "source_list_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "server_list_state_server_id_servers_id_fk": { + "name": "server_list_state_server_id_servers_id_fk", + "tableFrom": "server_list_state", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "server_list_state_source_list_id_lists_id_fk": { + "name": "server_list_state_source_list_id_lists_id_fk", + "tableFrom": "server_list_state", + "tableTo": "lists", + "columnsFrom": [ + "source_list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "server_list_state_server_id_kind_steam_id_pk": { + "name": "server_list_state_server_id_kind_steam_id_pk", + "columns": [ + "server_id", + "kind", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_list_sync": { + "name": "server_list_sync", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "synced_at": { + "name": "synced_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "server_list_sync_server_id_servers_id_fk": { + "name": "server_list_sync_server_id_servers_id_fk", + "tableFrom": "server_list_sync", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_lists": { + "name": "server_lists", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "list_id": { + "name": "list_id", + "type": "text", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "server_lists_list_idx": { + "name": "server_lists_list_idx", + "columns": [ + { + "expression": "list_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "server_lists_server_id_servers_id_fk": { + "name": "server_lists_server_id_servers_id_fk", + "tableFrom": "server_lists", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "server_lists_list_id_lists_id_fk": { + "name": "server_lists_list_id_lists_id_fk", + "tableFrom": "server_lists", + "tableTo": "lists", + "columnsFrom": [ + "list_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "server_lists_server_id_list_id_pk": { + "name": "server_lists_server_id_list_id_pk", + "columns": [ + "server_id", + "list_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_live": { + "name": "server_live", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "ok": { + "name": "ok", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "tier": { + "name": "tier", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'idle'" + }, + "build": { + "name": "build", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "game_server_id": { + "name": "game_server_id", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "started_at": { + "name": "started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "reserved_slots": { + "name": "reserved_slots", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "restart_time_utc": { + "name": "restart_time_utc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "restart_time_utc_file": { + "name": "restart_time_utc_file", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "players": { + "name": "players", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "player_count": { + "name": "player_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "status_at": { + "name": "status_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "players_at": { + "name": "players_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "observed_at": { + "name": "observed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "feed_at": { + "name": "feed_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "match_state": { + "name": "match_state", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "server_live_server_id_servers_id_fk": { + "name": "server_live_server_id_servers_id_fk", + "tableFrom": "server_live", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_reserved": { + "name": "server_reserved", + "schema": "", + "columns": { + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "configured": { + "name": "configured", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "live": { + "name": "live", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "seen_at": { + "name": "seen_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "server_reserved_server_id_servers_id_fk": { + "name": "server_reserved_server_id_servers_id_fk", + "tableFrom": "server_reserved", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": { + "server_reserved_server_id_steam_id_pk": { + "name": "server_reserved_server_id_steam_id_pk", + "columns": [ + "server_id", + "steam_id" + ] + } + }, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.servers": { + "name": "servers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "host": { + "name": "host", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "port": { + "name": "port", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "scheme": { + "name": "scheme", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'http'" + }, + "password_enc": { + "name": "password_enc", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notes": { + "name": "notes", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "sort_order": { + "name": "sort_order", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "allow_private": { + "name": "allow_private", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "feed_token_enc": { + "name": "feed_token_enc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "feed_token_hash": { + "name": "feed_token_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "public_status": { + "name": "public_status", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "public_leaderboards": { + "name": "public_leaderboards", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "public_kills": { + "name": "public_kills", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "restart_schedule": { + "name": "restart_schedule", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": { + "servers_org_id_organizations_id_fk": { + "name": "servers_org_id_organizations_id_fk", + "tableFrom": "servers", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "servers_feed_token_hash_unique": { + "name": "servers_feed_token_hash_unique", + "nullsNotDistinct": false, + "columns": [ + "feed_token_hash" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_user_id_idx": { + "name": "session_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.site_settings": { + "name": "site_settings", + "schema": "", + "columns": { + "key": { + "name": "key", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "value": { + "name": "value", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_by": { + "name": "updated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.steam_profiles": { + "name": "steam_profiles", + "schema": "", + "columns": { + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "persona": { + "name": "persona", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "avatar": { + "name": "avatar", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "profile_url": { + "name": "profile_url", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "public": { + "name": "public", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "account_created_at": { + "name": "account_created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "vac_bans": { + "name": "vac_bans", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "game_bans": { + "name": "game_bans", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "days_since_last_ban": { + "name": "days_since_last_ban", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "community_banned": { + "name": "community_banned", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "economy_ban": { + "name": "economy_ban", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'none'" + }, + "friends_state": { + "name": "friends_state", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'unknown'" + }, + "friends_total": { + "name": "friends_total", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "friends_checked": { + "name": "friends_checked", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "banned_friends": { + "name": "banned_friends", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "friends_checked_at": { + "name": "friends_checked_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "fetched_at": { + "name": "fetched_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "error": { + "name": "error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.triggers": { + "name": "triggers", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "server_id": { + "name": "server_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "kind": { + "name": "kind", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "config": { + "name": "config", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "state": { + "name": "state", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "last_fired_at": { + "name": "last_fired_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_result": { + "name": "last_result", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "fire_count": { + "name": "fire_count", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 0 + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "triggers_server_idx": { + "name": "triggers_server_idx", + "columns": [ + { + "expression": "server_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "triggers_server_id_servers_id_fk": { + "name": "triggers_server_id_servers_id_fk", + "tableFrom": "triggers", + "tableTo": "servers", + "columnsFrom": [ + "server_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.two_factor": { + "name": "two_factor", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "secret": { + "name": "secret", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "backup_codes": { + "name": "backup_codes", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "verified": { + "name": "verified", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "failed_verification_count": { + "name": "failed_verification_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "locked_until": { + "name": "locked_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "two_factor_user_id_idx": { + "name": "two_factor_user_id_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "two_factor_secret_idx": { + "name": "two_factor_secret_idx", + "columns": [ + { + "expression": "secret", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "two_factor_user_id_user_id_fk": { + "name": "two_factor_user_id_user_id_fk", + "tableFrom": "two_factor", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_username": { + "name": "display_username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "must_change_password": { + "name": "must_change_password", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "steam_id": { + "name": "steam_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "default_org_id": { + "name": "default_org_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "two_factor_enabled": { + "name": "two_factor_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "auth_complete": { + "name": "auth_complete", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "auth_grace_started_at": { + "name": "auth_grace_started_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "recovery_key_hash": { + "name": "recovery_key_hash", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "recovery_key_at": { + "name": "recovery_key_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_default_org_id_organizations_id_fk": { + "name": "user_default_org_id_organizations_id_fk", + "tableFrom": "user", + "tableTo": "organizations", + "columnsFrom": [ + "default_org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "set null", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + }, + "user_steam_id_unique": { + "name": "user_steam_id_unique", + "nullsNotDistinct": false, + "columns": [ + "steam_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.webhooks": { + "name": "webhooks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "org_id": { + "name": "org_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "url_enc": { + "name": "url_enc", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "url_hint": { + "name": "url_hint", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "events": { + "name": "events", + "type": "jsonb", + "primaryKey": false, + "notNull": true + }, + "trigger_kinds": { + "name": "trigger_kinds", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "server_ids": { + "name": "server_ids", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "status_enabled": { + "name": "status_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status_style": { + "name": "status_style", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'banner'" + }, + "status_interval_s": { + "name": "status_interval_s", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 60 + }, + "link_status": { + "name": "link_status", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "link_leaderboard": { + "name": "link_leaderboard", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": true + }, + "link_panel": { + "name": "link_panel", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "status_messages": { + "name": "status_messages", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "status_sent_at": { + "name": "status_sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_sent_at": { + "name": "last_sent_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_status": { + "name": "last_status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_error": { + "name": "last_error", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "created_by": { + "name": "created_by", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "webhooks_org_idx": { + "name": "webhooks_org_idx", + "columns": [ + { + "expression": "org_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "webhooks_org_id_organizations_id_fk": { + "name": "webhooks_org_id_organizations_id_fk", + "tableFrom": "webhooks", + "tableTo": "organizations", + "columnsFrom": [ + "org_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.worker_ownership": { + "name": "worker_ownership", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "label": { + "name": "label", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "''" + }, + "acquired_at": { + "name": "acquired_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "lease_until": { + "name": "lease_until", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index f634c598..c47231b1 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -358,6 +358,13 @@ "when": 1792156935138, "tag": "0050_org_saved_messages", "breakpoints": true + }, + { + "idx": 51, + "version": "7", + "when": 1792283936471, + "tag": "0051_idle_seconds", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/lib/components/LeaderboardTable.svelte b/src/lib/components/LeaderboardTable.svelte index 126d3d9d..d8eabfb9 100644 --- a/src/lib/components/LeaderboardTable.svelte +++ b/src/lib/components/LeaderboardTable.svelte @@ -249,7 +249,9 @@ {#if show('deaths')}