|
|
|
@ -2,7 +2,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE (
|
|
|
|
|
ID BIGSERIAL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(300) DEFAULT NULL,
|
|
|
|
|
PROVIDER_TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE
|
|
|
|
|
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
UNIQUE(NAME)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
@ -272,7 +273,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_STATUS (
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_POLICY_CHANGE_MGT (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
POLICY_ID INTEGER NOT NULL,
|
|
|
|
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
|
|
|
|
DEVICE_TYPE VARCHAR(300) NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
@ -289,18 +290,11 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_COMPLIANCE_FEATURES (
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_GROUP_ID INT NOT NULL,
|
|
|
|
|
POLICY_ID INT NOT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
|
|
|
|
FOREIGN KEY (DEVICE_GROUP_ID)
|
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
@ -350,6 +344,52 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
|
|
|
|
|
|
-- DEVICE GROUP TABLES --
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GROUP (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
DESCRIPTION BYTEA DEFAULT NULL,
|
|
|
|
|
DATE_OF_CREATE INTEGER DEFAULT NULL,
|
|
|
|
|
DATE_OF_LAST_UPDATE INTEGER DEFAULT NULL,
|
|
|
|
|
OWNER VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
|
|
|
|
|
REFERENCES DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
|
|
|
|
CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- END OF DEVICE GROUP TABLES --
|
|
|
|
|
|
|
|
|
|
-- POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_GROUP_ID INTEGER NOT NULL,
|
|
|
|
|
POLICY_ID INTEGER NOT NULL,
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
|
|
|
|
FOREIGN KEY (DEVICE_GROUP_ID)
|
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
|
|
|
|
|
|
-- NOTIFICATION TABLE --
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_NOTIFICATION (
|
|
|
|
|
NOTIFICATION_ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
@ -420,7 +460,7 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|
|
|
|
CPU_USAGE DECIMAL(5) NULL,
|
|
|
|
|
TOTAL_RAM_MEMORY DECIMAL(30,3) NULL,
|
|
|
|
|
AVAILABLE_RAM_MEMORY DECIMAL(30,3) NULL,
|
|
|
|
|
PLUGGED_IN INT NULL,
|
|
|
|
|
PLUGGED_IN BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
UPDATE_TIMESTAMP BIGINT NOT NULL,
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_DETAILS_DEVICE
|
|
|
|
|
FOREIGN KEY (DEVICE_ID)
|
|
|
|
|