-- +goose Up
-- Stage 17: per-account hidden games. A row hides game_id from account_id's own "my games"
-- lobby list, leaving it visible to the other players. Only finished games are hidden, and the
-- action is irreversible by design (there is no un-hide). Queried with raw SQL, so no generated
-- jet code is needed.
SET search_path = backend, pg_catalog;

CREATE TABLE game_hidden (
    account_id uuid        NOT NULL REFERENCES accounts (account_id) ON DELETE CASCADE,
    game_id    uuid        NOT NULL REFERENCES games (game_id) ON DELETE CASCADE,
    created_at timestamptz NOT NULL DEFAULT now(),
    PRIMARY KEY (account_id, game_id)
);

-- +goose Down
SET search_path = backend, pg_catalog;

DROP TABLE game_hidden;
