This commits fixes the issues of having the Application memory info and is-active flag with the DM_APPLICATION table, because those values should go to to DM_APPLICATION_MAPPING table. Change of the tables has happened.

revert-70aa11f8
geethkokila 7 years ago
parent 531f209b2c
commit b652d025c8

@ -225,6 +225,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId); applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId);
Application installedApp; Application installedApp;
List<Integer> applicationIds = new ArrayList<>(); List<Integer> applicationIds = new ArrayList<>();
List<Application> applicationsToMap = new ArrayList<>();
for (Application application : applications) { for (Application application : applications) {
// Adding N/A if application doesn't have a version. Also truncating the application version, // Adding N/A if application doesn't have a version. Also truncating the application version,
@ -232,17 +233,18 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
if (application.getVersion() == null) { if (application.getVersion() == null) {
application.setVersion("N/A"); application.setVersion("N/A");
} else if (application.getVersion().length() > } else if (application.getVersion().length() >
DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH) { DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH) {
application.setVersion(StringUtils.abbreviate(application.getVersion(), application.setVersion(StringUtils.abbreviate(application.getVersion(),
DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH)); DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH));
} }
if (!installedAppList.contains(application)) { if (!installedAppList.contains(application)) {
installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(), installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(),
application.getVersion(), tenantId); application.getVersion(), device.getId(), tenantId);
if (installedApp == null) { if (installedApp == null) {
appsToAdd.add(application); appsToAdd.add(application);
} else { } else {
applicationIds.add(installedApp.getId()); application.setId(installedApp.getId());
applicationsToMap.add(application);
} }
} }
} }
@ -250,11 +252,18 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
log.debug("num of apps add:" + appsToAdd.size()); log.debug("num of apps add:" + appsToAdd.size());
} }
applicationIds.addAll(applicationDAO.addApplications(appsToAdd, tenantId)); applicationIds.addAll(applicationDAO.addApplications(appsToAdd, tenantId));
// Getting the applications ids for the second time
for (Application application : appsToAdd) {
installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(),
application.getVersion(), device.getId(), tenantId);
application.setId(installedApp.getId());
applicationsToMap.add(application);
}
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("num of app Ids:" + applicationIds.size()); log.debug("num of app Ids:" + applicationIds.size());
} }
applicationMappingDAO.addApplicationMappings(device.getId(), applicationIds, tenantId); applicationMappingDAO.addApplicationMappingsWithApps(device.getId(), applicationsToMap, tenantId);
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("num of remove app Ids:" + appIdsToRemove.size()); log.debug("num of remove app Ids:" + appIdsToRemove.size());
@ -267,7 +276,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (TransactionManagementException e) { } catch (TransactionManagementException e) {
String msg = "Error occurred while initializing transaction for saving application list to the device " String msg = "Error occurred while initializing transaction for saving application list to the device "
+ deviceIdentifier.toString(); + deviceIdentifier.toString();
log.error(msg, e); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (DeviceManagementException e) { } catch (DeviceManagementException e) {
@ -310,14 +319,14 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while opening a connection to the data source to get application " + String msg = "Error occurred while opening a connection to the data source to get application " +
"list of the device " + deviceId.toString(); "list of the device " + deviceId.toString();
log.error(msg, e); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} catch (Exception e) { } catch (Exception e) {
String msg = "Exception occurred getting application list of the device " + deviceId.toString(); String msg = "Exception occurred getting application list of the device " + deviceId.toString();
log.error(msg, e); log.error(msg, e);
throw new ApplicationManagementException(msg, e); throw new ApplicationManagementException(msg, e);
} finally { } finally {
DeviceManagementDAOFactory.closeConnection(); DeviceManagementDAOFactory.closeConnection();
} }
} }

@ -34,5 +34,7 @@ public interface ApplicationDAO {
Application getApplication(String identifier, String version,int tenantId) throws DeviceManagementDAOException; Application getApplication(String identifier, String version,int tenantId) throws DeviceManagementDAOException;
Application getApplication(String identifier, String version, int deviceId, int tenantId) throws DeviceManagementDAOException;
List<Application> getInstalledApplications(int deviceId) throws DeviceManagementDAOException; List<Application> getInstalledApplications(int deviceId) throws DeviceManagementDAOException;
} }

@ -29,6 +29,9 @@ public interface ApplicationMappingDAO {
void addApplicationMappings(int deviceId, List<Integer> applicationIds, int tenantId) void addApplicationMappings(int deviceId, List<Integer> applicationIds, int tenantId)
throws DeviceManagementDAOException; throws DeviceManagementDAOException;
void addApplicationMappingsWithApps(int deviceId, List<Application> applications, int tenantId)
throws DeviceManagementDAOException;
void removeApplicationMapping(int deviceId, List<Integer> appIdList, int tenantId) void removeApplicationMapping(int deviceId, List<Integer> appIdList, int tenantId)
throws DeviceManagementDAOException; throws DeviceManagementDAOException;
} }

@ -112,8 +112,6 @@ public class ApplicationDAOImpl implements ApplicationDAO {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs; ResultSet rs;
ByteArrayOutputStream bao = null;
ObjectOutputStream oos = null;
List<Integer> applicationIds = new ArrayList<>(); List<Integer> applicationIds = new ArrayList<>();
try { try {
conn = this.getConnection(); conn = this.getConnection();
@ -133,14 +131,15 @@ public class ApplicationDAOImpl implements ApplicationDAO {
stmt.setString(7, application.getImageUrl()); stmt.setString(7, application.getImageUrl());
stmt.setInt(8, tenantId); stmt.setInt(8, tenantId);
bao = new ByteArrayOutputStream(); // Removing the application properties saving from the application table.
oos = new ObjectOutputStream(bao); stmt.setBigDecimal(9, null);
oos.writeObject(application.getAppProperties());
stmt.setBytes(9, bao.toByteArray());
stmt.setString(10, application.getApplicationIdentifier()); stmt.setString(10, application.getApplicationIdentifier());
stmt.setInt(11, application.getMemoryUsage());
stmt.setBoolean(12, application.isActive()); // Removing the application memory
stmt.setInt(11, 0);
stmt.setBoolean(12, true);
stmt.executeUpdate(); stmt.executeUpdate();
rs = stmt.getGeneratedKeys(); rs = stmt.getGeneratedKeys();
@ -151,23 +150,7 @@ public class ApplicationDAOImpl implements ApplicationDAO {
return applicationIds; return applicationIds;
} catch (SQLException e) { } catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while adding bulk application list", e); throw new DeviceManagementDAOException("Error occurred while adding bulk application list", e);
} catch (IOException e) {
throw new DeviceManagementDAOException("Error occurred while serializing application properties object", e);
} finally { } finally {
if (bao != null) {
try {
bao.close();
} catch (IOException e) {
log.error("Error occurred while closing ByteArrayOutputStream", e);
}
}
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
log.error("Error occurred while closing ObjectOutputStream", e);
}
}
DeviceManagementDAOUtil.cleanupResources(stmt, null); DeviceManagementDAOUtil.cleanupResources(stmt, null);
} }
} }
@ -264,6 +247,38 @@ public class ApplicationDAOImpl implements ApplicationDAO {
} }
} }
@Override
public Application getApplication(String identifier, String version, int deviceId, int tenantId) throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
Application application = null;
try {
conn = this.getConnection();
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, appmap.APP_PROPERTIES, appmap.MEMORY_USAGE, appmap.IS_ACTIVE, TENANT_ID " +
"FROM DM_APPLICATION app INNER JOIN " +
"(SELECT APPLICATION_ID, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE FROM DM_DEVICE_APPLICATION_MAPPING W" +
"HERE DEVICE_ID = ?) appmap WHERE app.APP_IDENTIFIER = ? AND app.VERSION = ? AND " +
"appmap.APPLICATION_ID = app.id AND TENANT_ID = ?");
stmt.setInt(1, deviceId);
stmt.setString(2, identifier);
stmt.setString(3, version);
stmt.setInt(4, tenantId);
rs = stmt.executeQuery();
if (rs.next()) {
application = this.loadApplication(rs);
}
return application;
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while retrieving application application '" +
identifier + "' and version '" + version + "'.", e);
} finally {
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
private Connection getConnection() throws SQLException { private Connection getConnection() throws SQLException {
return DeviceManagementDAOFactory.getConnection(); return DeviceManagementDAOFactory.getConnection();
} }
@ -278,9 +293,10 @@ public class ApplicationDAOImpl implements ApplicationDAO {
try { try {
conn = this.getConnection(); conn = this.getConnection();
stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " + stmt = conn.prepareStatement("Select ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
"LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE, TENANT_ID From DM_APPLICATION app " + "LOCATION_URL, IMAGE_URL, APPMAP.APP_PROPERTIES, APPMAP.MEMORY_USAGE, APPMAP.IS_ACTIVE, " +
"INNER JOIN " + "TENANT_ID From DM_APPLICATION app INNER JOIN " +
"(Select APPLICATION_ID From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " + "(Select APPLICATION_ID, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE" +
" From DM_DEVICE_APPLICATION_MAPPING WHERE DEVICE_ID=?) APPMAP " +
"ON " + "ON " +
"app.ID = APPMAP.APPLICATION_ID "); "app.ID = APPMAP.APPLICATION_ID ");

@ -28,9 +28,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation; import org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation;
import java.io.ByteArrayInputStream; import java.io.*;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -38,6 +36,8 @@ import java.util.Properties;
public class ApplicationMappingDAOImpl implements ApplicationMappingDAO { public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
private static final Log log = LogFactory.getLog(ApplicationMappingDAOImpl.class);
@Override @Override
public int addApplicationMapping(int deviceId, int applicationId, public int addApplicationMapping(int deviceId, int applicationId,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {
@ -49,7 +49,7 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
conn = this.getConnection(); conn = this.getConnection();
String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, " + String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, " +
"TENANT_ID) VALUES (?, ?, ?)"; "TENANT_ID) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(sql, new String[] {"id"}); stmt = conn.prepareStatement(sql, new String[]{"id"});
stmt.setInt(1, deviceId); stmt.setInt(1, deviceId);
stmt.setInt(2, applicationId); stmt.setInt(2, applicationId);
stmt.setInt(3, tenantId); stmt.setInt(3, tenantId);
@ -69,7 +69,7 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
@Override @Override
public void addApplicationMappings(int deviceId, List<Integer> applicationIds, public void addApplicationMappings(int deviceId, List<Integer> applicationIds,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {
Connection conn; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
@ -96,6 +96,64 @@ public class ApplicationMappingDAOImpl implements ApplicationMappingDAO {
} }
} }
@Override
public void addApplicationMappingsWithApps(int deviceId, List<Application> applications, int tenantId)
throws DeviceManagementDAOException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
ByteArrayOutputStream bao = null;
ObjectOutputStream oos = null;
try {
conn = this.getConnection();
String sql = "INSERT INTO DM_DEVICE_APPLICATION_MAPPING (DEVICE_ID, APPLICATION_ID, APP_PROPERTIES, " +
"MEMORY_USAGE, IS_ACTIVE, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?)";
conn.setAutoCommit(false);
stmt = conn.prepareStatement(sql);
for (Application application : applications) {
stmt.setInt(1, deviceId);
stmt.setInt(2, application.getId());
bao = new ByteArrayOutputStream();
oos = new ObjectOutputStream(bao);
oos.writeObject(application.getAppProperties());
stmt.setBytes(3, bao.toByteArray());
stmt.setInt(4, application.getMemoryUsage());
stmt.setBoolean(5, application.isActive());
stmt.setInt(6, tenantId);
stmt.addBatch();
}
stmt.executeBatch();
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while adding device application mappings", e);
} catch (IOException e) {
throw new DeviceManagementDAOException("Error occurred while serializing application properties object", e);
} finally {
if (bao != null) {
try {
bao.close();
} catch (IOException e) {
log.error("Error occurred while closing ByteArrayOutputStream", e);
}
}
if (oos != null) {
try {
oos.close();
} catch (IOException e) {
log.error("Error occurred while closing ObjectOutputStream", e);
}
}
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
@Override @Override
public void removeApplicationMapping(int deviceId, List<Integer> appIdList, public void removeApplicationMapping(int deviceId, List<Integer> appIdList,
int tenantId) throws DeviceManagementDAOException { int tenantId) throws DeviceManagementDAOException {

@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -418,6 +418,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -301,7 +301,7 @@ CREATE TABLE IF NOT EXISTS DM_POLICY_CRITERIA_PROPERTIES (
POLICY_CRITERION_ID INT NOT NULL, POLICY_CRITERION_ID INT NOT NULL,
PROP_KEY VARCHAR(45) NULL, PROP_KEY VARCHAR(45) NULL,
PROP_VALUE VARCHAR(100) NULL, PROP_VALUE VARCHAR(100) NULL,
CONTENT BLOB NULL COMMENT 'This is used to ', CONTENT BLOB NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES CONSTRAINT FK_POLICY_CRITERIA_PROPERTIES
FOREIGN KEY (POLICY_CRITERION_ID) FOREIGN KEY (POLICY_CRITERION_ID)
@ -367,6 +367,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -396,6 +396,9 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER IDENTITY(1,1) NOT NULL, ID INTEGER IDENTITY(1,1) NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES VARBINARY(MAX) NULL,
MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BIT NOT NULL DEFAULT 0,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT FK_DM_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT FK_DM_DEVICE FOREIGN KEY (DEVICE_ID) REFERENCES

@ -411,6 +411,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID INTEGER AUTO_INCREMENT NOT NULL, ID INTEGER AUTO_INCREMENT NOT NULL,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE INTEGER(10) NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
PRIMARY KEY (ID), PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -715,6 +715,9 @@ CREATE TABLE DM_DEVICE_APPLICATION_MAPPING (
ID NUMBER(10) NOT NULL, ID NUMBER(10) NOT NULL,
DEVICE_ID NUMBER(10) NOT NULL, DEVICE_ID NUMBER(10) NOT NULL,
APPLICATION_ID NUMBER(10) NOT NULL, APPLICATION_ID NUMBER(10) NOT NULL,
APP_PROPERTIES BLOB NULL,
MEMORY_USAGE NUMBER(10) NULL,
IS_ACTIVE NUMBER(10) DEFAULT 0 NOT NULL,
TENANT_ID NUMBER(10) NOT NULL, TENANT_ID NUMBER(10) NOT NULL,
CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID), CONSTRAINT PK_DM_DEVICE_APP_MAPPING PRIMARY KEY (ID),
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES

@ -357,6 +357,9 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_APPLICATION_MAPPING (
ID BIGSERIAL NOT NULL PRIMARY KEY, ID BIGSERIAL NOT NULL PRIMARY KEY,
DEVICE_ID INTEGER NOT NULL, DEVICE_ID INTEGER NOT NULL,
APPLICATION_ID INTEGER NOT NULL, APPLICATION_ID INTEGER NOT NULL,
APP_PROPERTIES BYTEA NULL,
MEMORY_USAGE INTEGER NULL,
IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE,
TENANT_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL,
CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES CONSTRAINT fk_dm_device FOREIGN KEY (DEVICE_ID) REFERENCES
DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, DM_DEVICE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,

Loading…
Cancel
Save