aboutsummaryrefslogtreecommitdiff
path: root/database/init_db.sql
blob: 2ce8a1e7cc12f5df23b2a58e46480c0537558dde (plain)
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
PRAGMA foreign_keys = ON;

create table if not exists users (
	user_id text primary key not null,
	username varchar(35) not null,
	email text not null,
	status text,
	country text,
	password_hash text not null,
	registered integer not null,
	valid_tokens text,
	verified_email boolean not null,
	type text not null,
	preferences text not null,
	avatar text,
	presence text
);

create table if not exists games (
	game_id text primary key not null,
	parent_game text,
	moves text,
	player_1_id text not null,
	player_2_id text,
	outcome text,
	created integer,
	started integer,
	last_activity integer,
	duration integer,
	rating_delta_player_1 integer,
	rating_delta_player_2 integer,
	status text not null,
	ruleset text not null,
	private boolean not null,
	debug boolean not null,
	foreign key(player_1_id) references users(user_id),
	foreign key(player_2_id) references users(user_id)
);

create table if not exists social (
	user_id text not null,
	friends text,
	blocked text,
	pending text,
	foreign key(user_id) references users(user_id)
);