|
|
|
@ -1,19 +1,17 @@
|
|
|
|
|
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,
|
|
|
|
|
ID BIGSERIAL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(300) DEFAULT NULL,
|
|
|
|
|
PROVIDER_TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
|
|
|
|
UNIQUE(NAME, PROVIDER_TENANT_ID)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_GROUP (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
|
NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
OWNER VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
|
OWNER VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
|
|
|
|
@ -21,11 +19,12 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
|
ROLE VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
CONSTRAINT fk_DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_DEVICE (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DESCRIPTION TEXT DEFAULT NULL,
|
|
|
|
@ -45,7 +44,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
|
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
|
TENANT_ID INTEGER DEFAULT 0,
|
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
|
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)
|
|
|
|
@ -323,31 +321,6 @@ 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,
|
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
DEVICE_ID INTEGER NOT NULL,
|
|
|
|
|
OWNER VARCHAR(50) NOT NULL,
|
|
|
|
|
OWNERSHIP VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
STATUS VARCHAR(50) NULL,
|
|
|
|
|
DATE_OF_ENROLMENT TIMESTAMP NULL DEFAULT NULL,
|
|
|
|
|
DATE_OF_LAST_UPDATE TIMESTAMP NULL DEFAULT NULL,
|
|
|
|
|
TENANT_ID INT NOT NULL,
|
|
|
|
|
CONSTRAINT fk_dm_device_enrolment FOREIGN KEY (DEVICE_ID) REFERENCES
|
|
|
|
|
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS DM_APPLICATION (
|
|
|
|
|
ID BIGSERIAL NOT NULL PRIMARY KEY,
|
|
|
|
|
NAME VARCHAR(150) NOT NULL,
|
|
|
|
@ -377,31 +350,6 @@ 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 (
|
|
|
|
@ -481,7 +429,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_DETAIL (
|
|
|
|
|
DEVICE_MODEL VARCHAR(45) NULL,
|
|
|
|
|
VENDOR VARCHAR(45) NULL,
|
|
|
|
|
OS_VERSION VARCHAR(45) NULL,
|
|
|
|
|
|
|
|
|
|
OS_BUILD_DATE VARCHAR(100) NULL,
|
|
|
|
|
BATTERY_LEVEL DECIMAL(4) NULL,
|
|
|
|
|
INTERNAL_TOTAL_MEMORY DECIMAL(30,3) NULL,
|
|
|
|
@ -558,5 +505,4 @@ DM_DEVICE.DEVICE_TYPE_ID = DM_DEVICE_TYPE.ID AND
|
|
|
|
|
DM_DEVICE.ID = DM_DEVICE_DETAIL.DEVICE_ID
|
|
|
|
|
ORDER BY TENANT_ID, DEVICE_ID;
|
|
|
|
|
|
|
|
|
|
-- END OF DASHBOARD RELATED VIEWS --
|
|
|
|
|
|
|
|
|
|
-- END OF DASHBOARD RELATED VIEWS --
|