using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace GameList.Data.Migrations { /// public partial class InitialCreate : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AppState", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), CurrentPhase = table.Column(type: "INTEGER", nullable: false), UpdatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_AppState", x => x.Id); }); migrationBuilder.CreateTable( name: "Players", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), DisplayName = table.Column(type: "TEXT", maxLength: 64, nullable: true), CreatedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Players", x => x.Id); }); migrationBuilder.CreateTable( name: "Suggestions", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), PlayerId = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", maxLength: 100, nullable: false), Genre = table.Column(type: "TEXT", maxLength: 50, nullable: true), Description = table.Column(type: "TEXT", maxLength: 500, nullable: true), ScreenshotUrl = table.Column(type: "TEXT", maxLength: 2048, nullable: true), YoutubeUrl = table.Column(type: "TEXT", maxLength: 2048, nullable: true), CreatedAt = table.Column(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(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), PlayerId = table.Column(type: "TEXT", nullable: false), SuggestionId = table.Column(type: "INTEGER", nullable: false), Score = table.Column(type: "INTEGER", nullable: false), CreatedAt = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AppState"); migrationBuilder.DropTable( name: "Votes"); migrationBuilder.DropTable( name: "Suggestions"); migrationBuilder.DropTable( name: "Players"); } } }