-
Notifications
You must be signed in to change notification settings - Fork 0
/
psql.command.1
53 lines (50 loc) · 1.58 KB
/
psql.command.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- Table for account details
CREATE TABLE public.accounts (
skins jsonb NULL,
password text NOT NULL,
secret text NOT NULL,
email text NULL,
username text NOT NULL,
coins int8 NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT now(),
id serial NOT NULL,
lastusernamechange timestamp(6) without time zone NULL
);
ALTER TABLE public.accounts ADD CONSTRAINT accounts_pkey PRIMARY KEY (id);
-- Table for game details
CREATE TABLE public.games (
"time" bigint NULL,
killerverified boolean NULL,
verified boolean NULL,
name text NULL,
killedby text NULL,
created_at timestamp without time zone NULL DEFAULT now(),
kills bigint NULL,
coins bigint NULL,
id serial NOT NULL
);
ALTER TABLE public.games ADD CONSTRAINT games_pkey PRIMARY KEY (id);
-- Table for game stats
CREATE TABLE public.stats (
id serial NOT NULL,
game_date date NOT NULL DEFAULT CURRENT_DATE,
username text NOT NULL,
game_time bigint NOT NULL DEFAULT 0,
game_count integer NOT NULL DEFAULT 0,
stabs integer NOT NULL DEFAULT 0,
coins integer NOT NULL DEFAULT 0
);
ALTER TABLE public.stats ADD CONSTRAINT stats_pkey PRIMARY KEY (id);
ALTER TABLE stats ADD CONSTRAINT unique_username UNIQUE (username, game_date);
-- Table for content details
CREATE TABLE public.content (
id serial NOT NULL,
created_at timestamp without time zone NOT NULL DEFAULT now(),
link text NULL,
title text NULL,
author text NULL,
chance integer NOT NULL DEFAULT 1,
source text NOT NULL DEFAULT 'youtube'::text,
label text NULL
);
ALTER TABLE public.content ADD CONSTRAINT content_pkey PRIMARY KEY (id);