ping reporting + service unit
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
-- Registration email. Run in Supabase Dashboard → SQL Editor.
|
||||
-- Application stores normalized (trimmed, lower-case) addresses.
|
||||
|
||||
alter table public.users
|
||||
add column if not exists email text null;
|
||||
|
||||
create unique index if not exists users_email_unique
|
||||
on public.users (email)
|
||||
where email is not null;
|
||||
@@ -1,8 +0,0 @@
|
||||
-- `users.rc` as type `real` is IEEE float32: above ~1e7, consecutive values are spaced
|
||||
-- by more than 1 (and by hundreds at ~4e9), so debits like -20 do not change the stored value.
|
||||
-- Run this in Supabase SQL before relying on `purchase_rc` or large RC balances.
|
||||
--
|
||||
-- After this, re-apply public.purchase_rc from schemas/rpc_purchase_rc.sql (no ::real casts).
|
||||
|
||||
alter table public.users
|
||||
alter column rc type bigint using round(coalesce(rc, 0))::bigint;
|
||||
@@ -0,0 +1,14 @@
|
||||
-- Per-match ping telemetry reported by game clients.
|
||||
create table if not exists public.ping_reports (
|
||||
id bigint generated by default as identity not null,
|
||||
created_at timestamp with time zone not null default now(),
|
||||
user_id bigint not null references public.users(id),
|
||||
match_id bigint not null references public.matches(id),
|
||||
ip_address text null,
|
||||
ping integer not null,
|
||||
constraint ping_reports_pkey primary key (id)
|
||||
);
|
||||
|
||||
create index if not exists ping_reports_user_id_idx on public.ping_reports(user_id);
|
||||
create index if not exists ping_reports_match_id_idx on public.ping_reports(match_id);
|
||||
create index if not exists ping_reports_created_at_idx on public.ping_reports(created_at);
|
||||
@@ -0,0 +1,11 @@
|
||||
create table public.ping_reports (
|
||||
id bigint generated by default as identity not null,
|
||||
created_at timestamp with time zone not null default now(),
|
||||
user_id bigint not null,
|
||||
match_id bigint not null,
|
||||
ip_address text null,
|
||||
ping integer not null,
|
||||
constraint ping_reports_pkey primary key (id),
|
||||
constraint ping_reports_user_id_fkey foreign key (user_id) references users (id),
|
||||
constraint ping_reports_match_id_fkey foreign key (match_id) references matches (id)
|
||||
) TABLESPACE pg_default;
|
||||
@@ -4,6 +4,7 @@ create table public.users (
|
||||
username text null,
|
||||
email text null,
|
||||
password text null,
|
||||
ip_address text null,
|
||||
cc real null default '0'::real,
|
||||
rc real null default '0'::real,
|
||||
last_logged_at timestamp with time zone null default now(),
|
||||
|
||||
Reference in New Issue
Block a user