Created
January 20, 2021 11:41
-
-
Save georgepaoli/bdacf03babe099ff7fe6cd2b68b36ba9 to your computer and use it in GitHub Desktop.
IdentityServer4 SQL scripts for SqlServer: PersistedGrants and DeviceCodes tables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE "PersistedGrants" | |
( | |
"Key" varchar(200) NOT NULL, | |
"Type" varchar(50) NOT NULL, | |
"SubjectId" varchar(200), | |
"SessionId" varchar(100), | |
"ClientId" varchar(200) NOT NULL, | |
"Description" varchar(200), | |
"CreationTime" datetime NOT NULL, | |
"Expiration" datetime, | |
"ConsumedTime" datetime, | |
"Data" varchar(max) NOT NULL, | |
CONSTRAINT "PK_PersistedGrants" PRIMARY KEY ("Key") | |
) | |
GO | |
CREATE INDEX "IX_PersistedGrants_Expiration" ON "PersistedGrants" ("Expiration"); | |
CREATE INDEX "IX_PersistedGrants_SubjectId_ClientId_Type" ON "PersistedGrants" ("SubjectId", "ClientId", "Type"); | |
CREATE INDEX "IX_PersistedGrants_SubjectId_SessionId_Type" ON "PersistedGrants" ("SubjectId", "SessionId", "Type"); | |
GO | |
CREATE TABLE "DeviceCodes" | |
( | |
"UserCode" varchar(200) NOT NULL, | |
"DeviceCode" varchar(200) NOT NULL, | |
"SubjectId" varchar(200), | |
"SessionId" varchar(100), | |
"ClientId" varchar(200) NOT NULL, | |
"Description" varchar(200), | |
"CreationTime" datetime NOT NULL, | |
"Expiration" datetime NOT NULL, | |
"Data" varchar(max) NOT NULL, | |
CONSTRAINT "PK_DeviceCodes" PRIMARY KEY ("UserCode") | |
) | |
GO | |
CREATE UNIQUE INDEX "IX_DeviceCodes_DeviceCode" ON "DeviceCodes" ("DeviceCode"); | |
CREATE INDEX "IX_DeviceCodes_Expiration" ON "DeviceCodes" ("Expiration"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment