-- Create table itself:
NOT EXISTS games.games (
game_uid VARCHAR(20) PRIMARY KEY,
start_ts TIMESTAMP WITHOUT TIME ZONE NOT NULL
);
SELECT ON games.games TO freeorion;
-- Create table to link users and games:
NOT EXISTS games.players (
game_uid VARCHAR(20) REFERENCES games.games(game_uid),
player_name CITEXT REFERENCES auth.users(player_name),
is_confirmed BOOLEAN NOT NULL DEFAULT FALSE,
species VARCHAR(20) NOT NULL DEFAULT 'RANDOM',
CONSTRAINT pk_players PRIMARY KEY (game_uid, player_name)
);
SELECT ON games.players TO freeorion;