Spaces:
Paused
Paused
Download schema.sql from Skydata001/space: direct link, hf CLI and curl.
- Browser
- Download file 3.17 kB
-
https://huggingface.co/spaces/Skydata001/space/resolve/main/schema.sql
- Command line
-
hf download hf://spaces/Skydata001/space/schema.sql
-
curl -L -o schema.sql https://huggingface.co/spaces/Skydata001/space/resolve/main/schema.sql
3.17 kB
| create or replace function public.exec_ddl(sql text) | |
| returns void | |
| language plpgsql | |
| security definer | |
| set search_path = public | |
| as $$ | |
| begin | |
| execute sql; | |
| end; | |
| $$; | |
| revoke all on function public.exec_ddl(text) from public; | |
| revoke all on function public.exec_ddl(text) from anon; | |
| revoke all on function public.exec_ddl(text) from authenticated; | |
| grant execute on function public.exec_ddl(text) to service_role; | |
| create table if not exists public.players ( | |
| id bigint generated always as identity primary key, | |
| username text not null, | |
| username_norm text not null, | |
| password_hash text not null, | |
| is_admin boolean not null default false, | |
| admin_rank int not null default 0, | |
| rank_id int not null default 1, | |
| level int not null default 1, | |
| xp int not null default 0, | |
| money int not null default 0, | |
| ip text, | |
| device text, | |
| cookies jsonb not null default '{}'::jsonb, | |
| character_data jsonb not null default '{}'::jsonb, | |
| inventory jsonb not null default '[]'::jsonb, | |
| guns jsonb not null default '{"owned":[],"equipped":null}'::jsonb, | |
| stats jsonb not null default '{}'::jsonb, | |
| banned_until timestamptz, | |
| ban_reason text, | |
| last_login_at timestamptz, | |
| created_at timestamptz not null default now(), | |
| updated_at timestamptz not null default now()); | |
| create unique index if not exists players_username_norm_uidx on public.players (username_norm); | |
| create index if not exists players_is_admin_idx on public.players (is_admin); | |
| create index if not exists players_admin_rank_idx on public.players (admin_rank); | |
| create index if not exists players_rank_idx on public.players (rank_id); | |
| create index if not exists players_level_idx on public.players (level); | |
| create index if not exists players_created_idx on public.players (created_at desc); | |
| create index if not exists players_ip_idx on public.players (ip); | |
| create index if not exists players_login_idx on public.players (last_login_at desc); | |
| create index if not exists players_inventory_gin on public.players using gin (inventory); | |
| create index if not exists players_guns_gin on public.players using gin (guns); | |
| create index if not exists players_stats_gin on public.players using gin (stats); | |
| create table if not exists public.audit_log ( | |
| id bigint generated always as identity primary key, | |
| admin_id bigint not null, | |
| admin_name text not null, | |
| action text not null, | |
| target_id bigint, | |
| target_name text, | |
| detail text, | |
| created_at timestamptz not null default now()); | |
| create index if not exists audit_created_idx on public.audit_log (created_at desc); | |
| create index if not exists audit_admin_idx on public.audit_log (admin_id); | |
| create table if not exists public.chat_log ( | |
| id bigint generated always as identity primary key, | |
| player_id bigint not null, | |
| player_name text not null, | |
| msg text not null, | |
| room text not null default 'global', | |
| created_at timestamptz not null default now()); | |
| create index if not exists chat_created_idx on public.chat_log (created_at desc); | |
| create index if not exists chat_player_idx on public.chat_log (player_id); | |