Fix issues in the MSSQL db script
@@ -129,8 +129,6 @@ CREATE TABLE IDN_OAUTH2_ACCESS_TOKEN_AUDIT (
IDP_ID INTEGER
);
-
-
IF EXISTS (SELECT NAME FROM SYSINDEXES WHERE NAME = 'IDX_AT_CK_AU')
DROP INDEX IDN_OAUTH2_ACCESS_TOKEN.IDX_AT_CK_AU
@@ -157,7 +155,6 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
);
-
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_AUTHZ_CODE_SCOPE]') AND TYPE IN (N'U'))
CREATE TABLE IDN_OAUTH2_AUTHZ_CODE_SCOPE (
CODE_ID VARCHAR (255),
@@ -168,7 +165,7 @@ CREATE TABLE IDN_OAUTH2_AUTHZ_CODE_SCOPE (
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_DEVICE_FLOW]') AND TYPE IN (N'U'))
-CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW (
+CREATE TABLE IDN_OAUTH2_DEVICE_FLOW (
CODE_ID VARCHAR(255),
DEVICE_CODE VARCHAR(255),
USER_CODE VARCHAR(25),
@@ -183,13 +180,14 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW (
USER_DOMAIN VARCHAR(50),
IDP_ID INTEGER,
PRIMARY KEY (DEVICE_CODE),
+ UNIQUE (CODE_ID),
UNIQUE (CODE_ID, USER_CODE, DEVICE_CODE),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OAUTH2_DEVICE_FLOW_SCOPES]') AND TYPE IN (N'U'))
-CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES (
- ID INTEGER NOT NULL AUTO_INCREMENT,
+CREATE TABLE IDN_OAUTH2_DEVICE_FLOW_SCOPES (
+ ID INTEGER NOT NULL IDENTITY,
SCOPE_ID VARCHAR(255),
SCOPE VARCHAR(255),
PRIMARY KEY (ID),
@@ -242,9 +240,6 @@ CREATE TABLE IDN_SCIM_GROUP (
PRIMARY KEY (ID)
);
-
-
-
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[IDN_OPENID_REMEMBER_ME]') AND TYPE IN (N'U'))
CREATE TABLE IDN_OPENID_REMEMBER_ME (
USER_NAME VARCHAR(255) NOT NULL,
