Fix db2 script issues
@@ -155,7 +155,7 @@ CREATE TABLE IDN_OAUTH2_AUTHORIZATION_CODE (
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE)
INDEX IN TS32K
/
-CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHZ_CODE_SCOPE(
+CREATE TABLE IDN_OAUTH2_AUTHZ_CODE_SCOPE(
CODE_ID VARCHAR(255) NOT NULL,
SCOPE VARCHAR(60) NOT NULL,
TENANT_ID INTEGER DEFAULT -1,
@@ -163,10 +163,10 @@ CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHZ_CODE_SCOPE(
FOREIGN KEY (CODE_ID) REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE (CODE_ID) ON DELETE CASCADE)
/
-CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW (
- CODE_ID VARCHAR(255),
- DEVICE_CODE VARCHAR(255),
- USER_CODE VARCHAR(25),
+CREATE TABLE IDN_OAUTH2_DEVICE_FLOW (
+ CODE_ID VARCHAR(255) NOT NULL,
+ DEVICE_CODE VARCHAR(255) NOT NULL,
+ USER_CODE VARCHAR(25) NOT NULL,
CONSUMER_KEY_ID INTEGER,
LAST_POLL_TIME TIMESTAMP NOT NULL,
EXPIRY_TIME TIMESTAMP NOT NULL,
@@ -178,12 +178,13 @@ 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)
/
-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 GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1),
SCOPE_ID VARCHAR(255),
SCOPE VARCHAR(255),
PRIMARY KEY (ID),
