-- Add table to store queries to delegation

CREATE TABLE IF NOT EXISTS games.query_delegation (
    game_uid VARCHAR(20) REFERENCES games.games(game_uid),
    player_name CITEXT REFERENCES auth.users(player_name),
    delegate_name CITEXT REFERENCES auth.users(player_name), 
    CONSTRAINT pk_query_delegation PRIMARY KEY (game_uid, player_name, delegate_name)
);
GRANT SELECT, INSERT, DELETE ON games.query_delegation TO freeorion;