Merge pull request #797 from sinthuja/master

Fixing issues in IoT core with MSSQL.
4.x.x
Geeth 8 years ago committed by GitHub
commit a47d2a6672

@ -18,8 +18,6 @@
package org.wso2.carbon.device.mgt.core.dao.impl; package org.wso2.carbon.device.mgt.core.dao.impl;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.GroupPaginationRequest; import org.wso2.carbon.device.mgt.common.GroupPaginationRequest;
import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup; import org.wso2.carbon.device.mgt.common.group.mgt.DeviceGroup;
import org.wso2.carbon.device.mgt.core.dao.GroupDAO; import org.wso2.carbon.device.mgt.core.dao.GroupDAO;

@ -64,7 +64,7 @@ public class SQLServerGroupDAOImpl extends AbstractGroupDAOImpl {
hasOwner = true; hasOwner = true;
} }
if (hasLimit) { if (hasLimit) {
sql += " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; sql += " ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
} }
int paramIndex = 1; int paramIndex = 1;
@ -127,7 +127,7 @@ public class SQLServerGroupDAOImpl extends AbstractGroupDAOImpl {
} }
sql += ")"; sql += ")";
if (hasLimit) { if (hasLimit) {
sql += " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; sql += " ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
} }
int paramIndex = 1; int paramIndex = 1;
@ -177,7 +177,7 @@ public class SQLServerGroupDAOImpl extends AbstractGroupDAOImpl {
" DM_DEVICE d, (" + " DM_DEVICE d, (" +
"SELECT dgm.DEVICE_ID FROM DM_DEVICE_GROUP_MAP dgm WHERE dgm.GROUP_ID = ?) dgm1 " + "SELECT dgm.DEVICE_ID FROM DM_DEVICE_GROUP_MAP dgm WHERE dgm.GROUP_ID = ?) dgm1 " +
"WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t " + "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t " +
"WHERE gd.DEVICE_TYPE_ID = t.ID) d1 WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ? OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ? ORDER BY d1.DEVICE_ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
stmt = conn.prepareStatement(sql); stmt = conn.prepareStatement(sql);
stmt.setInt(1, groupId); stmt.setInt(1, groupId);

@ -432,12 +432,15 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
List<Device> devices; List<Device> devices;
try { try {
rowCount = DeviceManagerUtil.validateDeviceListPageSize(rowCount);
GroupManagementDAOFactory.openConnection(); GroupManagementDAOFactory.openConnection();
devices = this.groupDAO.getDevices(groupId, startIndex, rowCount, tenantId); devices = this.groupDAO.getDevices(groupId, startIndex, rowCount, tenantId);
} catch (GroupManagementDAOException e) { } catch (GroupManagementDAOException e) {
throw new GroupManagementException("Error occurred while getting devices in group.", e); throw new GroupManagementException("Error occurred while getting devices in group.", e);
} catch (SQLException e) { } catch (SQLException e) {
throw new GroupManagementException("Error occurred while opening a connection to the data source.", e); throw new GroupManagementException("Error occurred while opening a connection to the data source.", e);
} catch (DeviceManagementException e) {
throw new GroupManagementException("Error occurred while validating the limit of the devices to be returned", e);
} finally { } finally {
GroupManagementDAOFactory.closeConnection(); GroupManagementDAOFactory.closeConnection();
} }

@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER DEFAULT 0,
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) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
); );
CREATE TABLE IF NOT EXISTS DM_DEVICE ( CREATE TABLE IF NOT EXISTS DM_DEVICE (
@ -46,9 +46,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER DEFAULT 0,
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) ON DELETE NO ACTION ON UPDATE NO ACTION, REFERENCES DM_DEVICE (ID) ON DELETE CASCADE 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) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
); );
CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATE TABLE IF NOT EXISTS DM_OPERATION (
@ -448,13 +448,13 @@ CREATE TABLE IF NOT EXISTS 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 --

@ -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 --

@ -26,8 +26,8 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) CONSTRAINT 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
) )
ENGINE = InnoDB; ENGINE = InnoDB;
@ -54,12 +54,12 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
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
) )
ENGINE = InnoDB; ENGINE = InnoDB;
@ -399,36 +399,6 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
-- END OF POLICY RELATED TABLES -- -- END OF POLICY RELATED TABLES --
-- DEVICE GROUP TABLES --
CREATE TABLE IF NOT EXISTS DM_GROUP (
ID INTEGER AUTO_INCREMENT NOT NULL,
GROUP_NAME VARCHAR(100) DEFAULT NULL,
DESCRIPTION TEXT DEFAULT NULL,
DATE_OF_CREATE BIGINT DEFAULT NULL,
DATE_OF_LAST_UPDATE BIGINT DEFAULT NULL,
OWNER VARCHAR(45) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID)
)ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
ID INTEGER AUTO_INCREMENT NOT NULL,
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)
REFERENCES DM_GROUP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
)ENGINE = InnoDB;
-- END OF DEVICE GROUP TABLES --
-- POLICY AND DEVICE GROUP MAPPING -- -- POLICY AND DEVICE GROUP MAPPING --
CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY ( CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_POLICY (
@ -440,13 +410,13 @@ CREATE TABLE IF NOT EXISTS 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
)ENGINE = InnoDB; )ENGINE = InnoDB;
-- END OF POLICY AND DEVICE GROUP MAPPING -- -- END OF POLICY AND DEVICE GROUP MAPPING --

@ -50,8 +50,10 @@ CREATE TABLE DM_ROLE_GROUP_MAP (
ROLE VARCHAR2(45) DEFAULT NULL, ROLE VARCHAR2(45) DEFAULT NULL,
TENANT_ID NUMBER(10) DEFAULT 0, TENANT_ID NUMBER(10) DEFAULT 0,
CONSTRAINT PK_DM_ROLE_GROUP PRIMARY KEY (ID), CONSTRAINT PK_DM_ROLE_GROUP PRIMARY KEY (ID),
CONSTRAINT fk_DM_ROLE_GROUP_MAP_GROUP2 FOREIGN KEY (GROUP_ID) CONSTRAINT fk_DM_ROLE_GROUP_MAP_GROUP2
FOREIGN KEY (GROUP_ID)
REFERENCES DM_GROUP (ID) REFERENCES DM_GROUP (ID)
ON DELETE CASCADE
) )
/ /
-- Generate ID using sequence and trigger -- Generate ID using sequence and trigger
@ -103,10 +105,14 @@ CREATE TABLE DM_DEVICE_GROUP_MAP (
GROUP_ID NUMBER(10) DEFAULT NULL, GROUP_ID NUMBER(10) DEFAULT NULL,
TENANT_ID NUMBER(10) DEFAULT 0, TENANT_ID NUMBER(10) DEFAULT 0,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_DEV2 FOREIGN KEY (DEVICE_ID) CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_DEV2
REFERENCES DM_DEVICE (ID), FOREIGN KEY (DEVICE_ID)
CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID) REFERENCES DM_DEVICE (ID)
ON DELETE CASCADE,
CONSTRAINT fk_DM_DEV_GROUP_MAP_DM_GROUP2
FOREIGN KEY (GROUP_ID)
REFERENCES DM_GROUP (ID) REFERENCES DM_GROUP (ID)
ON DELETE CASCADE
) )
/ /
-- Generate ID using sequence and trigger -- Generate ID using sequence and trigger
@ -631,10 +637,11 @@ 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 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 CASCADE
) )
/ /
-- Generate ID using sequence and trigger -- Generate ID using sequence and trigger

@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
ROLE VARCHAR(45) DEFAULT NULL, ROLE VARCHAR(45) DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER DEFAULT 0,
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) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
); );
CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID); CREATE INDEX IDX_DEVICE_TYPE ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
@ -45,9 +45,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP (
GROUP_ID INTEGER DEFAULT NULL, GROUP_ID INTEGER DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0, TENANT_ID INTEGER DEFAULT 0,
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) ON DELETE NO ACTION ON UPDATE NO ACTION, REFERENCES DM_DEVICE (ID) ON DELETE CASCADE 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) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES DM_GROUP (ID) ON DELETE CASCADE ON UPDATE CASCADE
); );
CREATE TABLE IF NOT EXISTS DM_OPERATION ( CREATE TABLE IF NOT EXISTS DM_OPERATION (
@ -360,13 +360,13 @@ CREATE TABLE IF NOT EXISTS 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 --

Loading…
Cancel
Save