|
|
@ -34,8 +34,8 @@ IF NOT EXISTS(SELECT *
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT FK_DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
CONSTRAINT FK_DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE CASCADE
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE]') AND TYPE IN (N'U'))
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE]') AND TYPE IN (N'U'))
|
|
|
@ -63,12 +63,12 @@ IF NOT EXISTS(SELECT *
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
PRIMARY KEY (ID),
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_MAP_DM_DEVICE2 FOREIGN KEY (DEVICE_ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
REFERENCES DM_DEVICE (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
ON UPDATE CASCADE,
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE CASCADE
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DM_DEVICE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE'))
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_DM_DEVICE' AND OBJECT_ID = OBJECT_ID('DM_DEVICE'))
|
|
|
@ -387,35 +387,6 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
|
|
|
|
|
|
|
|
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
-- POLICY RELATED TABLES FINISHED --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- DEVICE GROUP TABLES --
|
|
|
|
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_GROUP]') AND TYPE IN (N'U'))
|
|
|
|
|
|
|
|
CREATE TABLE DM_GROUP (
|
|
|
|
|
|
|
|
ID INTEGER IDENTITY(1,1) NOT NULL,
|
|
|
|
|
|
|
|
GROUP_NAME VARCHAR(100) DEFAULT NULL,
|
|
|
|
|
|
|
|
DESCRIPTION VARCHAR(MAX) DEFAULT NULL,
|
|
|
|
|
|
|
|
DATE_OF_CREATE BIGINT DEFAULT NULL,
|
|
|
|
|
|
|
|
DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
|
|
|
|
|
|
|
|
OWNER VARCHAR(45) DEFAULT NULL,
|
|
|
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
|
|
|
|
PRIMARY KEY (ID)
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_MAP]') AND TYPE IN (N'U'))
|
|
|
|
|
|
|
|
CREATE TABLE DM_DEVICE_GROUP_MAP (
|
|
|
|
|
|
|
|
ID INTEGER IDENTITY(1,1) NOT NULL,
|
|
|
|
|
|
|
|
DEVICE_ID INTEGER DEFAULT NULL,
|
|
|
|
|
|
|
|
GROUP_ID INTEGER DEFAULT NULL,
|
|
|
|
|
|
|
|
TENANT_ID INTEGER NOT NULL,
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- END OF DEVICE GROUP TABLES --
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
-- POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_POLICY]') AND TYPE IN (N'U'))
|
|
|
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_GROUP_POLICY]') AND TYPE IN (N'U'))
|
|
|
|
CREATE TABLE DM_DEVICE_GROUP_POLICY (
|
|
|
|
CREATE TABLE DM_DEVICE_GROUP_POLICY (
|
|
|
@ -427,13 +398,13 @@ CREATE TABLE DM_DEVICE_GROUP_POLICY (
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
|
|
|
|
FOREIGN KEY (DEVICE_GROUP_ID)
|
|
|
|
FOREIGN KEY (DEVICE_GROUP_ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
REFERENCES DM_GROUP (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
ON UPDATE CASCADE ,
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
FOREIGN KEY (POLICY_ID)
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
REFERENCES DM_POLICY (ID)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE CASCADE
|
|
|
|
ON UPDATE NO ACTION
|
|
|
|
ON UPDATE CASCADE
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|
-- END OF POLICY AND DEVICE GROUP MAPPING --
|
|
|
|