Add create table query for corrective action

4.x.x
Saad Sahibjan 5 years ago
parent e3905e793d
commit 5b53136b38

@ -202,6 +202,19 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
ON UPDATE NO ACTION
);
CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION (
ID INT(11) NOT NULL AUTO_INCREMENT,
ACTION_TYPE VARCHAR(45) NOT NULL,
CORRECTIVE_POLICY_ID INT(11) DEFAULT NULL,
POLICY_ID INT(11) NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION
FOREIGN KEY (POLICY_ID )
REFERENCES DM_POLICY (ID )
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT ,
DEVICE_ID INT(11) NOT NULL ,

@ -252,6 +252,20 @@ CREATE TABLE DM_POLICY (
ON DELETE NO ACTION ON UPDATE NO ACTION
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_POLICY_CORRECTIVE_ACTION]') AND TYPE IN (N'U'))
CREATE TABLE DM_POLICY_CORRECTIVE_ACTION (
ID INTEGER IDENTITY(1,1) NOT NULL,
ACTION_TYPE VARCHAR(45) NOT NULL,
CORRECTIVE_POLICY_ID INTEGER DEFAULT NULL,
POLICY_ID INTEGER NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_POLICY]') AND TYPE IN (N'U'))
CREATE TABLE DM_DEVICE_POLICY (
ID INTEGER IDENTITY(1,1) NOT NULL,

@ -233,6 +233,19 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION (
ID INT(11) NOT NULL AUTO_INCREMENT,
ACTION_TYPE VARCHAR(45) NOT NULL,
CORRECTIVE_POLICY_ID INT(11) DEFAULT NULL,
POLICY_ID INT(11) NOT NULL,
PRIMARY KEY (ID),
CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ID INT(11) NOT NULL AUTO_INCREMENT ,

@ -364,6 +364,19 @@ CREATE TABLE DM_POLICY (
REFERENCES DM_PROFILE (ID )
)
/
CREATE TABLE DM_POLICY_CORRECTIVE_ACTION (
ID NUMBER(10) NOT NULL,
ACTION_TYPE VARCHAR2(45) NOT NULL,
CORRECTIVE_POLICY_ID NUMBER(10) DEFAULT NULL,
POLICY_ID NUMBER(10) NOT NULL,
CONSTRAINT PK_DM_POLICY_CORRECTIVE_ACTION PRIMARY KEY (ID),
CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
)
/
-- Generate ID using sequence and trigger
CREATE SEQUENCE DM_POLICY_seq START WITH 1 INCREMENT BY 1 NOCACHE
/

@ -202,6 +202,18 @@ CREATE TABLE IF NOT EXISTS DM_POLICY (
ON UPDATE NO ACTION
);
CREATE TABLE IF NOT EXISTS DM_POLICY_CORRECTIVE_ACTION (
ID BIGSERIAL NOT NULL PRIMARY KEY,
ACTION_TYPE VARCHAR(45) NOT NULL,
CORRECTIVE_POLICY_ID INTEGER DEFAULT NULL,
POLICY_ID INTEGER NOT NULL,
CONSTRAINT FK_DM_POLICY_DM_POLICY_CORRECTIVE_ACTION
FOREIGN KEY (POLICY_ID)
REFERENCES DM_POLICY (ID)
ON DELETE NO ACTION
ON UPDATE NO ACTION
);
CREATE TABLE IF NOT EXISTS DM_DEVICE_POLICY (
ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_ID INTEGER NOT NULL ,

Loading…
Cancel
Save