using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace SharpbinV3.Server.Migrations { /// public partial class AddApiKeys : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ApiKeys", columns: table => new { UUID = table.Column(type: "TEXT", nullable: false), UserUUID = table.Column(type: "TEXT", nullable: false), KeyHash = table.Column(type: "TEXT", nullable: false), Name = table.Column(type: "TEXT", nullable: false), CreatedAt = table.Column(type: "INTEGER", nullable: false), LastUsedAt = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_ApiKeys", x => x.UUID); table.ForeignKey( name: "FK_ApiKeys_Users_UserUUID", column: x => x.UserUUID, principalTable: "Users", principalColumn: "UUID", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ApiKeys_UserUUID", table: "ApiKeys", column: "UserUUID"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ApiKeys"); } } }