aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/migrations/2022-01-02-105610_matches/up.sql
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-server/migrations/2022-01-02-105610_matches/up.sql')
-rw-r--r--planetwars-server/migrations/2022-01-02-105610_matches/up.sql14
1 files changed, 14 insertions, 0 deletions
diff --git a/planetwars-server/migrations/2022-01-02-105610_matches/up.sql b/planetwars-server/migrations/2022-01-02-105610_matches/up.sql
new file mode 100644
index 0000000..88c8c9e
--- /dev/null
+++ b/planetwars-server/migrations/2022-01-02-105610_matches/up.sql
@@ -0,0 +1,14 @@
+CREATE TABLE matches (
+ id SERIAL PRIMARY KEY,
+ log_path text NOT NULL,
+ created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE INDEX match_created_at ON matches(created_at);
+
+CREATE TABLE match_players (
+ match_id integer REFERENCES matches(id) NOT NULL,
+ bot_id integer REFERENCES bots(id) NOT NULL,
+ player_id integer NOT NULL,
+ PRIMARY KEY (match_id, player_id)
+); \ No newline at end of file