76 lines
3.0 KiB
C#
76 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace LiteCharmsSecurity.Admin.EntityFramework.PostgreSQL.Migrations.IdentityServerGrants
|
|
{
|
|
public partial class DbInit : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "DeviceCodes",
|
|
columns: table => new
|
|
{
|
|
UserCode = table.Column<string>(maxLength: 200, nullable: false),
|
|
DeviceCode = table.Column<string>(maxLength: 200, nullable: false),
|
|
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
|
|
ClientId = table.Column<string>(maxLength: 200, nullable: false),
|
|
CreationTime = table.Column<DateTime>(nullable: false),
|
|
Expiration = table.Column<DateTime>(nullable: false),
|
|
Data = table.Column<string>(maxLength: 50000, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DeviceCodes", x => x.UserCode);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PersistedGrants",
|
|
columns: table => new
|
|
{
|
|
Key = table.Column<string>(maxLength: 200, nullable: false),
|
|
Type = table.Column<string>(maxLength: 50, nullable: false),
|
|
SubjectId = table.Column<string>(maxLength: 200, nullable: true),
|
|
ClientId = table.Column<string>(maxLength: 200, nullable: false),
|
|
CreationTime = table.Column<DateTime>(nullable: false),
|
|
Expiration = table.Column<DateTime>(nullable: true),
|
|
Data = table.Column<string>(maxLength: 50000, nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PersistedGrants", x => x.Key);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DeviceCodes_DeviceCode",
|
|
table: "DeviceCodes",
|
|
column: "DeviceCode",
|
|
unique: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DeviceCodes_Expiration",
|
|
table: "DeviceCodes",
|
|
column: "Expiration");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PersistedGrants_Expiration",
|
|
table: "PersistedGrants",
|
|
column: "Expiration");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PersistedGrants_SubjectId_ClientId_Type",
|
|
table: "PersistedGrants",
|
|
columns: new[] { "SubjectId", "ClientId", "Type" });
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DeviceCodes");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PersistedGrants");
|
|
}
|
|
}
|
|
}
|