aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/migrations/2022-01-02-105610_matches/up.sql
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-01-02 16:14:03 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-01-02 16:14:03 +0100
commit85dcf3ba2fd0cf907610625399db691b274118bb (patch)
tree3fd041b1de19a9d3130be2045a7f9b9bd3a85fe0 /planetwars-server/migrations/2022-01-02-105610_matches/up.sql
parentbdb77f97d6af5a59e80d2b2552cd6994754cbf29 (diff)
downloadplanetwars.dev-85dcf3ba2fd0cf907610625399db691b274118bb.tar.xz
planetwars.dev-85dcf3ba2fd0cf907610625399db691b274118bb.zip
store matches in database
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