From 85dcf3ba2fd0cf907610625399db691b274118bb Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Sun, 2 Jan 2022 16:14:03 +0100
Subject: store matches in database

---
 .../migrations/2022-01-02-105610_matches/up.sql            | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 planetwars-server/migrations/2022-01-02-105610_matches/up.sql

(limited to 'planetwars-server/migrations/2022-01-02-105610_matches/up.sql')

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
-- 
cgit v1.2.3

