Add phase-gated API, cookie identity, and initial migration

This commit is contained in:
2026-01-28 14:46:59 +01:00
parent 257b473253
commit 68ba872031
6 changed files with 804 additions and 12 deletions

View File

@@ -0,0 +1,132 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace GameList.Data.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AppState",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
CurrentPhase = table.Column<int>(type: "INTEGER", nullable: false),
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppState", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Players",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
DisplayName = table.Column<string>(type: "TEXT", maxLength: 64, nullable: true),
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Players", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Suggestions",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PlayerId = table.Column<Guid>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
Genre = table.Column<string>(type: "TEXT", maxLength: 50, nullable: true),
Description = table.Column<string>(type: "TEXT", maxLength: 500, nullable: true),
ScreenshotUrl = table.Column<string>(type: "TEXT", maxLength: 2048, nullable: true),
YoutubeUrl = table.Column<string>(type: "TEXT", maxLength: 2048, nullable: true),
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Suggestions", x => x.Id);
table.ForeignKey(
name: "FK_Suggestions_Players_PlayerId",
column: x => x.PlayerId,
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Votes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
PlayerId = table.Column<Guid>(type: "TEXT", nullable: false),
SuggestionId = table.Column<int>(type: "INTEGER", nullable: false),
Score = table.Column<int>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Votes", x => x.Id);
table.ForeignKey(
name: "FK_Votes_Players_PlayerId",
column: x => x.PlayerId,
principalTable: "Players",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Votes_Suggestions_SuggestionId",
column: x => x.SuggestionId,
principalTable: "Suggestions",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.InsertData(
table: "AppState",
columns: new[] { "Id", "CurrentPhase", "UpdatedAt" },
values: new object[] { 1, 0, new DateTimeOffset(new DateTime(2026, 1, 28, 13, 46, 23, 267, DateTimeKind.Unspecified).AddTicks(1749), new TimeSpan(0, 0, 0, 0, 0)) });
migrationBuilder.CreateIndex(
name: "IX_Suggestions_PlayerId",
table: "Suggestions",
column: "PlayerId");
migrationBuilder.CreateIndex(
name: "IX_Votes_PlayerId_SuggestionId",
table: "Votes",
columns: new[] { "PlayerId", "SuggestionId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Votes_SuggestionId",
table: "Votes",
column: "SuggestionId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppState");
migrationBuilder.DropTable(
name: "Votes");
migrationBuilder.DropTable(
name: "Suggestions");
migrationBuilder.DropTable(
name: "Players");
}
}
}