Add sequence for sp_template auto increment
@@ -573,7 +573,7 @@ CREATE TRIGGER SP_AUTH_SCRIPT_TRIG NO CASCADE
END
/
CREATE TABLE SP_TEMPLATE (
- ID INTEGER AUTO_INCREMENT NOT NULL,
+ ID INTEGER NOT NULL,
TENANT_ID INTEGER NOT NULL,
NAME VARCHAR(255) NOT NULL,
DESCRIPTION VARCHAR(1023),
@@ -581,6 +581,15 @@ CREATE TABLE SP_TEMPLATE (
PRIMARY KEY (ID),
CONSTRAINT SP_TEMPLATE_CONSTRAINT UNIQUE (TENANT_ID, NAME))
/
+CREATE SEQUENCE SP_TEMPLATE_SEQUENCE START WITH 1 INCREMENT BY 1 NOCACHE
+ /
+CREATE TRIGGER SP_TEMPLATE_SEQUENCE_TRIGGER NO CASCADE BEFORE INSERT ON SP_TEMPLATE
+REFERENCING NEW AS NEW FOR EACH ROW MODE DB2SQL
+ BEGIN ATOMIC
+ SET (NEW.ID)
+ = (NEXTVAL FOR SP_TEMPLATE_SEQUENCE);
+ END
+/
CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID, NAME)
/
CREATE TABLE IDN_AUTH_WAIT_STATUS (
