using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace RR3CommunityServer.Migrations { /// public partial class UpdateGameAssetFields : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AlterColumn( name: "LocalPath", table: "GameAssets", type: "TEXT", nullable: true, oldClrType: typeof(string), oldType: "TEXT"); migrationBuilder.AlterColumn( name: "FileSha256", table: "GameAssets", type: "TEXT", nullable: true, oldClrType: typeof(string), oldType: "TEXT"); migrationBuilder.AddColumn( name: "Description", table: "GameAssets", type: "TEXT", nullable: true); migrationBuilder.AddColumn( name: "IsRequired", table: "GameAssets", type: "INTEGER", nullable: false, defaultValue: false); migrationBuilder.AddColumn( name: "UploadedAt", table: "GameAssets", type: "TEXT", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.CreateTable( name: "Accounts", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Username = table.Column(type: "TEXT", nullable: false), Email = table.Column(type: "TEXT", nullable: false), PasswordHash = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "TEXT", nullable: false), LastLoginAt = table.Column(type: "TEXT", nullable: true), IsActive = table.Column(type: "INTEGER", nullable: false), EmailVerified = table.Column(type: "INTEGER", nullable: false), EmailVerificationToken = table.Column(type: "TEXT", nullable: true), PasswordResetToken = table.Column(type: "TEXT", nullable: true), PasswordResetExpiry = table.Column(type: "TEXT", nullable: true), UserId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Accounts", x => x.Id); table.ForeignKey( name: "FK_Accounts_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id"); }); migrationBuilder.CreateTable( name: "DeviceAccounts", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), AccountId = table.Column(type: "INTEGER", nullable: false), DeviceId = table.Column(type: "TEXT", nullable: false), DeviceName = table.Column(type: "TEXT", nullable: true), LinkedAt = table.Column(type: "TEXT", nullable: false), LastUsedAt = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_DeviceAccounts", x => x.Id); table.ForeignKey( name: "FK_DeviceAccounts_Accounts_AccountId", column: x => x.AccountId, principalTable: "Accounts", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 1, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 2, 26, 23, 30, 24, 984, DateTimeKind.Utc).AddTicks(2221), new DateTime(2026, 2, 19, 23, 30, 24, 984, DateTimeKind.Utc).AddTicks(2218) }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 2, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 2, 26, 23, 30, 24, 984, DateTimeKind.Utc).AddTicks(2228), new DateTime(2026, 2, 19, 23, 30, 24, 984, DateTimeKind.Utc).AddTicks(2228) }); migrationBuilder.CreateIndex( name: "IX_Accounts_UserId", table: "Accounts", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_DeviceAccounts_AccountId", table: "DeviceAccounts", column: "AccountId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DeviceAccounts"); migrationBuilder.DropTable( name: "Accounts"); migrationBuilder.DropColumn( name: "Description", table: "GameAssets"); migrationBuilder.DropColumn( name: "IsRequired", table: "GameAssets"); migrationBuilder.DropColumn( name: "UploadedAt", table: "GameAssets"); migrationBuilder.AlterColumn( name: "LocalPath", table: "GameAssets", type: "TEXT", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "TEXT", oldNullable: true); migrationBuilder.AlterColumn( name: "FileSha256", table: "GameAssets", type: "TEXT", nullable: false, defaultValue: "", oldClrType: typeof(string), oldType: "TEXT", oldNullable: true); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 1, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 2, 26, 18, 9, 35, 116, DateTimeKind.Utc).AddTicks(3366), new DateTime(2026, 2, 19, 18, 9, 35, 116, DateTimeKind.Utc).AddTicks(3363) }); migrationBuilder.UpdateData( table: "TimeTrials", keyColumn: "Id", keyValue: 2, columns: new[] { "EndDate", "StartDate" }, values: new object[] { new DateTime(2026, 2, 26, 18, 9, 35, 116, DateTimeKind.Utc).AddTicks(3375), new DateTime(2026, 2, 19, 18, 9, 35, 116, DateTimeKind.Utc).AddTicks(3375) }); } } }