From a5f1018fda5572912c126b1e8dd656209fca0e46 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Tue, 11 Aug 2020 21:16:02 +0200 Subject: persisted grants --- .../20200811164236_INITIAL_IDENTITY_MIGRATION.cs | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 src/server/Migrations/IdentityServer/PersistedGrant/20200811164236_INITIAL_IDENTITY_MIGRATION.cs (limited to 'src/server/Migrations/IdentityServer/PersistedGrant/20200811164236_INITIAL_IDENTITY_MIGRATION.cs') diff --git a/src/server/Migrations/IdentityServer/PersistedGrant/20200811164236_INITIAL_IDENTITY_MIGRATION.cs b/src/server/Migrations/IdentityServer/PersistedGrant/20200811164236_INITIAL_IDENTITY_MIGRATION.cs new file mode 100644 index 0000000..5ae6fb2 --- /dev/null +++ b/src/server/Migrations/IdentityServer/PersistedGrant/20200811164236_INITIAL_IDENTITY_MIGRATION.cs @@ -0,0 +1,85 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Dough.Migrations.IdentityServer.PersistedGrant +{ + public partial class INITIAL_IDENTITY_MIGRATION : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "DeviceCodes", + columns: table => new + { + UserCode = table.Column(maxLength: 200, nullable: false), + DeviceCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Description = table.Column(maxLength: 200, nullable: true), + CreationTime = table.Column(nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DeviceCodes", x => x.UserCode); + }); + + migrationBuilder.CreateTable( + name: "PersistedGrants", + columns: table => new + { + Key = table.Column(maxLength: 200, nullable: false), + Type = table.Column(maxLength: 50, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + SessionId = table.Column(maxLength: 100, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Description = table.Column(maxLength: 200, nullable: true), + CreationTime = table.Column(nullable: false), + Expiration = table.Column(nullable: true), + ConsumedTime = table.Column(nullable: true), + Data = table.Column(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" }); + + migrationBuilder.CreateIndex( + name: "IX_PersistedGrants_SubjectId_SessionId_Type", + table: "PersistedGrants", + columns: new[] { "SubjectId", "SessionId", "Type" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "DeviceCodes"); + + migrationBuilder.DropTable( + name: "PersistedGrants"); + } + } +} -- cgit v1.3