-- Your SQL goes here
CREATE TABLE games (
id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
created_at TIMESTAMPTZ NOT NULL DEFAULT current_timestamp,
updated_at TIMESTAMPTZ NOT NULL DEFAULT current_timestamp,
host_id uuid REFERENCES users(id) NOT NULL,
guest_id uuid REFERENCES users(id) DEFAULT NULL,
state SMALLINT NOT NULL,
ended_at TIMESTAMPTZ DEFAULT NULL,
game_data_id uuid REFERENCES gamedata(id) NOT NULL
);
SELECT diesel_manage_updated_at('games');