-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_schema.sql
67 lines (67 loc) · 1.92 KB
/
database_schema.sql
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
drop table if exists "sessions";
create table "sessions" (
"id" text not null,
"data" text,
primary key("id")
);
drop table if exists "movementCards";
create table if not exists "movementCards" (
"id" integer,
"game_id" integer not null,
"robot_id" integer,
"movement" text not null,
"priority" integer not null,
"register" integer,
foreign key("game_id") references "games"("id"),
primary key("id" AUTOINCREMENT)
);
drop table if exists "fields";
create table if not exists "fields" (
"id" integer,
"game_id" integer not null,
"robot_id" integer,
"elements" integer not null,
"positionX" integer not null,
"positionY" integer not null,
"outgoingDirection" text,
"incomingDirections" text not null,
foreign key("game_id") references "games"("id"),
foreign key("robot_id") references "robots"("id"),
primary key("id" AUTOINCREMENT)
);
drop table if exists "robots";
create table if not exists "robots" (
"id" integer,
"game_id" integer not null,
"user_id" integer,
"name" text not null,
"ready" integer not null,
"model" text not null,
"facing" text not null,
"damage" integer not null,
"poweredDown" integer not null,
"powerDownScheduled" integer not null,
"passedCheckpoints" integer not null,
foreign key("game_id") references "games"("id"),
foreign key("user_id") references "users"("id"),
primary key("id" AUTOINCREMENT)
);
drop table if exists "users";
create table "users" (
"id" integer not null,
"name" text not null,
"password" text not null,
"salt" text not null,
primary key("id")
);
drop table if exists "games";
create table if not exists "games" (
"id" integer,
"boardType" text not null,
"maxRobots" int not null,
"currentRegister" integer not null,
"state" text not null,
"startedAt" integer,
"finishedAt" integer,
primary key("id" AUTOINCREMENT)
);