planetwars.dev/planetwars-server/migrations/2022-01-02-105610_matches/up.sql

17 lines
516 B
MySQL
Raw Normal View History

2022-02-08 19:13:24 +00:00
CREATE TYPE match_state AS ENUM ('playing', 'finished');
2022-01-03 22:33:00 +00:00
2022-01-02 15:14:03 +00:00
CREATE TABLE matches (
2022-01-03 22:33:00 +00:00
id SERIAL PRIMARY KEY NOT NULL,
state match_state NOT NULL,
2022-01-02 15:14:03 +00:00
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,
player_id integer NOT NULL,
2022-03-10 22:35:42 +00:00
code_bundle_id integer REFERENCES code_bundles(id) NOT NULL,
2022-01-02 15:14:03 +00:00
PRIMARY KEY (match_id, player_id)
);