using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace RadicadeServer.Migrations { public partial class AddAdminAuth : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AdminSessions", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), AdminUserId = table.Column(type: "bigint", nullable: false), TokenHash = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PreviousTokenHash = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), LastSeenAt = table.Column(type: "datetime2", nullable: false), ExpiresAt = table.Column(type: "datetime2", nullable: false), RevokedAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AdminSessions", x => x.Id); }); migrationBuilder.CreateTable( name: "AdminUsers", columns: table => new { Id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Username = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), PasswordHash = table.Column(type: "nvarchar(max)", nullable: false), TotpSecret = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: true), TotpEnabled = table.Column(type: "bit", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false), LastLoginAt = table.Column(type: "datetime2", nullable: true) }, constraints: table => { table.PrimaryKey("PK_AdminUsers", x => x.Id); }); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AdminSessions"); migrationBuilder.DropTable( name: "AdminUsers"); } } }