diff options
author | lonkaars <l.leblansch@gmail.com> | 2021-01-03 15:26:00 +0100 |
---|---|---|
committer | lonkaars <l.leblansch@gmail.com> | 2021-01-03 15:26:00 +0100 |
commit | bcaccefc8bea56c99b21a63bcb6b29f358174bf1 (patch) | |
tree | 6146fde19d57711db785cdebf320aaff5945b8f6 /database | |
parent | eb028f273531044dc92c011b9e69c123752d0372 (diff) |
added database initialization
Diffstat (limited to 'database')
-rwxr-xr-x | database/init_db.sh | 1 | ||||
-rw-r--r-- | database/init_db.sql | 43 |
2 files changed, 44 insertions, 0 deletions
diff --git a/database/init_db.sh b/database/init_db.sh new file mode 100755 index 0000000..0c5515b --- /dev/null +++ b/database/init_db.sh @@ -0,0 +1 @@ +sqlite3 database.db < init_db.sql diff --git a/database/init_db.sql b/database/init_db.sql new file mode 100644 index 0000000..cf26f7b --- /dev/null +++ b/database/init_db.sql @@ -0,0 +1,43 @@ +PRAGMA foreign_keys = ON; + +create table users ( + user_id text primary key not null, + username varchar(35) not null, + email text not null, + country text, + password_salt text not null, + 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 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, + timestamp integer, + duration integer, + rating_delta_player_1 integer, + rating_delta_player_2 integer, + ranked boolean, + status text not null, + foreign key(player_1_id) references users(user_id), + foreign key(player_2_id) references users(user_id) +); + +create table social ( + user_id text not null, + friends text, + blocked text, + pending text, + foreign key(user_id) references users(user_id) +); + |