-- CreateTable: game_high_scores (best score per user per game)
CREATE TABLE IF NOT EXISTS rebreak.game_high_scores (
    "id"        UUID        NOT NULL DEFAULT gen_random_uuid(),
    "user_id"   UUID        NOT NULL,
    "nickname"  TEXT        NOT NULL,
    "game_name" TEXT        NOT NULL,
    "score"     INTEGER     NOT NULL,
    "updated_at" TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,

    CONSTRAINT "game_high_scores_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX IF NOT EXISTS "game_high_scores_user_id_game_name_key"
    ON rebreak.game_high_scores ("user_id", "game_name");

CREATE INDEX IF NOT EXISTS "game_high_scores_game_name_score_idx"
    ON rebreak.game_high_scores ("game_name", "score" DESC);
