CREATE TABLE IDN_AUTH_SESSION_STORE (
SESSION_ID VARCHAR (100) NOT NULL,
SESSION_TYPE VARCHAR(100) NOT NULL,
SESSION_OBJECT BLOB,
TIME_CREATED TIMESTAMP,
PRIMARY KEY (SESSION_ID, SESSION_TYPE)
)/

UPDATE IDP_AUTHENTICATOR SET NAME='samlsso' WHERE NAME = 'saml2sso' AND TENANT_ID = '-1234'/

BEGIN
 DECLARE STMT VARCHAR(200);
 FOR v AS cur1 CURSOR FOR
   select CONSTNAME from SYSCAT.TABCONST WHERE TABNAME='IDP_PROVISIONING_ENTITY' AND TYPE = 'U'
 DO
  SET STMT = 'ALTER TABLE IDP_PROVISIONING_ENTITY DROP UNIQUE ' ||  v.CONSTNAME;
  PREPARE S1 FROM STMT;
  EXECUTE S1;
 END FOR;
END
/

ALTER TABLE IDP_PROVISIONING_ENTITY ADD CONSTRAINT IDP_PROVISIONING_ENTITY_U1 UNIQUE(PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE)
/

ALTER TABLE IDP_PROVISIONING_ENTITY ADD CONSTRAINT IDP_PROVISIONING_ENTITY_U2 UNIQUE(ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID)
/


