using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations { /// public partial class AddApiKeyTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ApiKey", columns: table => new { ApiKeyRowId = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWSEQUENTIALID()"), ApiKeyId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), Name = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), SecretHash = table.Column(type: "nvarchar(128)", maxLength: 128, nullable: false), Principal = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), Enabled = table.Column(type: "bit", nullable: false), CreatedUtc = table.Column(type: "datetime2", nullable: false), ExpiresUtc = table.Column(type: "datetime2", nullable: true), Notes = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), RowVersion = table.Column(type: "rowversion", rowVersion: true, nullable: false) }, constraints: table => { table.PrimaryKey("PK_ApiKey", x => x.ApiKeyRowId); }); migrationBuilder.CreateIndex( name: "IX_ApiKey_Principal", table: "ApiKey", column: "Principal"); migrationBuilder.CreateIndex( name: "UX_ApiKey_ApiKeyId", table: "ApiKey", column: "ApiKeyId", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ApiKey"); } } }