aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/migrations/2022-01-02-105610_matches
diff options
context:
space:
mode:
Diffstat (limited to 'planetwars-server/migrations/2022-01-02-105610_matches')
-rw-r--r--planetwars-server/migrations/2022-01-02-105610_matches/down.sql3
-rw-r--r--planetwars-server/migrations/2022-01-02-105610_matches/up.sql14
2 files changed, 17 insertions, 0 deletions
diff --git a/planetwars-server/migrations/2022-01-02-105610_matches/down.sql b/planetwars-server/migrations/2022-01-02-105610_matches/down.sql
new file mode 100644
index 0000000..eadd0fa
--- /dev/null
+++ b/planetwars-server/migrations/2022-01-02-105610_matches/down.sql
@@ -0,0 +1,3 @@
+DROP TABLE match_players;
+DROP INDEX match_created_at;
+DROP TABLE matches; \ No newline at end of file
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