diff --git a/modules/distribution/src/assembly/bin.xml b/modules/distribution/src/assembly/bin.xml
index 35216133..80a6852c 100755
--- a/modules/distribution/src/assembly/bin.xml
+++ b/modules/distribution/src/assembly/bin.xml
@@ -140,7 +140,6 @@
**/cdm-datasources.xml
**/tomcat/carbon/WEB-INF/web.xml
**/synapse.properties
- **/etc/device-analytics-config.xml
**/synapse-handlers.xml
**/tomcat/context.xml
**/security/Owasp.CsrfGuard.Carbon.properties
@@ -691,6 +690,12 @@
${project.artifactId}-${pom.version}/wso2/tools/identity-anonymization-tool/conf/sql/apim
+
+
+ ../migration
+ ${project.artifactId}-${pom.version}/dbscripts
+
+
@@ -1244,20 +1249,6 @@
true
644
-
-
- ${pom.artifactId}-${pom.version}/conf/etc
- device-analytics-config.xml
- true
- 644
-
-
-
- ${pom.artifactId}-${pom.version}/wso2/analytics/conf/etc
- device-analytics-config.xml
- true
- 644
-
@@ -1734,14 +1725,6 @@
${pom.artifactId}-${pom.version}/repository/resources/lifecycles
-
-
-
- ${pom.artifactId}-${pom.version}/repository/resources/devicetypes/analytics/
- 644
-
${pom.artifactId}-${pom.version}/samples/
diff --git a/modules/distribution/src/core/bin/iot-server.bat b/modules/distribution/src/core/bin/iot-server.bat
index 61711c34..9755fe43 100644
--- a/modules/distribution/src/core/bin/iot-server.bat
+++ b/modules/distribution/src/core/bin/iot-server.bat
@@ -167,7 +167,7 @@ set CARBON_CLASSPATH=.\lib;%CARBON_CLASSPATH%
set JAVA_ENDORSED=".\wso2\lib\endorsed";"%JAVA_HOME%\jre\lib\endorsed";"%JAVA_HOME%\lib\endorsed"
-set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dcarbon.registry.root=/ -Dcarbon.home="%CARBON_HOME%" -Dwso2.server.standalone=true -Djava.command="%JAVA_HOME%\bin\java" -Djava.opts="%JAVA_OPTS%" -Djava.io.tmpdir="%CARBON_HOME%\tmp" -Dlogger.server.name="IoT-Core" -Dcatalina.base="%CARBON_HOME%\wso2\lib\tomcat" -Djava.util.logging.config.file="%CARBON_HOME%\conf\etc\logging-bridge.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dcomponents.repo="%CARBON_HOME%\wso2\components\plugins" -Dcarbon.config.dir.path="%CARBON_HOME%\conf" -Dcarbon.components.dir.path="%CARBON_HOME%\wso2\components" -Dcarbon.extensions.dir.path="%CARBON_HOME%\extensions" -Dcarbon.dropins.dir.path="%CARBON_HOME%\dropins" -Dcarbon.external.lib.dir.path="%CARBON_HOME%\lib" -Dcarbon.patches.dir.path="%CARBON_HOME%\patches" -Dcarbon.servicepacks.dir.path="%CARBON_HOME%\servicepacks" -Dcarbon.internal.lib.dir.path="%CARBON_HOME%\wso2\lib" -Dconf.location="%CARBON_HOME%\conf" -Dcom.atomikos.icatch.file="%CARBON_HOME%\wso2\lib\transactions.properties" -Dcom.atomikos.icatch.hide_init_file_path=true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 -Dorg.terracotta.quartz.skipUpdateCheck=true -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dcom.ibm.cacheLocalHost=true -DworkerNode=false -Dorg.wso2.ignoreHostnameVerification=true -Dorg.opensaml.httpclient.https.disableHostnameVerification=true -Diot.analytics.host="localhost" -Diot.analytics.https.port="9445" -Diot.manager.host="localhost" -Diot.manager.https.port="9443" -Dmqtt.broker.host="localhost" -Dmqtt.broker.port="1886" -Diot.core.host="localhost" -Diot.core.https.port="9443" -Diot.keymanager.host="localhost" -Diot.keymanager.https.port="9443" -Diot.gateway.host="localhost" -Diot.gateway.https.port="8243" -Diot.gateway.http.port="8280" -Diot.gateway.carbon.https.port="9443" -Diot.gateway.carbon.http.port="9763" -Diot.apimpublisher.host="localhost" -Diot.apimpublisher.https.port="9443" -Diot.apimstore.host="localhost" -Diot.apimstore.https.port="9443"
+set CMD_LINE_ARGS=-Xbootclasspath/a:%CARBON_XBOOTCLASSPATH% -Xms256m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="%CARBON_HOME%\repository\logs\heap-dump.hprof" -Dcom.sun.management.jmxremote -classpath %CARBON_CLASSPATH% %JAVA_OPTS% -Djava.endorsed.dirs=%JAVA_ENDORSED% -Dcarbon.registry.root=/ -Dcarbon.home="%CARBON_HOME%" -Dwso2.server.standalone=true -Djava.command="%JAVA_HOME%\bin\java" -Djava.opts="%JAVA_OPTS%" -Djava.io.tmpdir="%CARBON_HOME%\tmp" -Dlogger.server.name="IoT-Core" -Dcatalina.base="%CARBON_HOME%\wso2\lib\tomcat" -Djava.util.logging.config.file="%CARBON_HOME%\conf\etc\logging-bridge.properties" -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dcomponents.repo="%CARBON_HOME%\wso2\components\plugins" -Dcarbon.config.dir.path="%CARBON_HOME%\conf" -Dcarbon.components.dir.path="%CARBON_HOME%\wso2\components" -Dcarbon.extensions.dir.path="%CARBON_HOME%\extensions" -Dcarbon.dropins.dir.path="%CARBON_HOME%\dropins" -Dcarbon.external.lib.dir.path="%CARBON_HOME%\lib" -Dcarbon.patches.dir.path="%CARBON_HOME%\patches" -Dcarbon.servicepacks.dir.path="%CARBON_HOME%\servicepacks" -Dcarbon.internal.lib.dir.path="%CARBON_HOME%\wso2\lib" -Dconf.location="%CARBON_HOME%\conf" -Dcom.atomikos.icatch.file="%CARBON_HOME%\wso2\lib\transactions.properties" -Dcom.atomikos.icatch.hide_init_file_path=true -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dcom.sun.jndi.ldap.connect.pool.authentication=simple -Dcom.sun.jndi.ldap.connect.pool.timeout=3000 -Dorg.terracotta.quartz.skipUpdateCheck=true -Djava.security.egd=file:/dev/./urandom -Dfile.encoding=UTF8 -Djava.net.preferIPv4Stack=true -Dcom.ibm.cacheLocalHost=true -DworkerNode=false -Dorg.wso2.ignoreHostnameVerification=true -Dorg.opensaml.httpclient.https.disableHostnameVerification=true -Diot.analytics.host="localhost" -Diot.analytics.http.port="9765" -Diot.analytics.https.port="9445" -Diot.analytics.thrift.port="7613" -Diot.manager.host="localhost" -Diot.manager.https.port="9443" -Dmqtt.broker.host="localhost" -Dmqtt.broker.port="1886" -Diot.core.host="localhost" -Diot.core.https.port="9443" -Diot.keymanager.host="localhost" -Diot.keymanager.https.port="9443" -Diot.gateway.host="localhost" -Diot.gateway.https.port="8243" -Diot.gateway.http.port="8280" -Diot.gateway.carbon.https.port="9443" -Diot.gateway.carbon.http.port="9763" -Diot.apimpublisher.host="localhost" -Diot.apimpublisher.https.port="9443" -Diot.apimstore.host="localhost" -Diot.apimstore.https.port="9443"
:runJava
echo JAVA_HOME environment variable is set to %JAVA_HOME%
echo CARBON_HOME environment variable is set to %CARBON_HOME%
diff --git a/modules/distribution/src/core/bin/iot-server.sh b/modules/distribution/src/core/bin/iot-server.sh
index 08366ec9..b412ae37 100755
--- a/modules/distribution/src/core/bin/iot-server.sh
+++ b/modules/distribution/src/core/bin/iot-server.sh
@@ -314,7 +314,9 @@ do
-Dorg.wso2.ignoreHostnameVerification=true \
-Dorg.opensaml.httpclient.https.disableHostnameVerification=true \
-Diot.analytics.host="localhost" \
+ -Diot.analytics.http.port="9765" \
-Diot.analytics.https.port="9445" \
+ -Diot.analytics.thrift.port="7613" \
-Diot.manager.host="localhost" \
-Diot.manager.https.port="9443" \
-Dmqtt.broker.host="localhost" \
diff --git a/modules/distribution/src/core/conf/api-manager.xml b/modules/distribution/src/core/conf/api-manager.xml
index fc1b1639..ff1e2020 100755
--- a/modules/distribution/src/core/conf/api-manager.xml
+++ b/modules/distribution/src/core/conf/api-manager.xml
@@ -86,8 +86,8 @@
Production and Sandbox
This is a hybrid gateway that handles both production and sandbox token traffic.
-
- https://${iot.gateway.host}:${iot.gateway.carbon.https.port}${carbon.context}services/
+
+ https://${iot.manager.host}:${iot.manager.https.port}${carbon.context}services/
${admin.username}
diff --git a/modules/distribution/src/core/conf/etc/device-analytics-config.xml b/modules/distribution/src/core/conf/etc/device-analytics-config.xml
deleted file mode 100644
index 7ca81c59..00000000
--- a/modules/distribution/src/core/conf/etc/device-analytics-config.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
-
- true
- tcp://localhost:7613
- admin
- admin
-
diff --git a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java
index c342e319..a871e1d2 100644
--- a/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java
+++ b/modules/integration/tests-integration/src/test/java/org/wso2/iot/integration/jmeter/DeviceTypeManagementJMeterTestCase.java
@@ -89,7 +89,7 @@ public class DeviceTypeManagementJMeterTestCase extends TestBase {
// Allow some time for message delivery
Thread.sleep(10000);
ArrayList mqttMessages = mqttDeviceSubscriberClient.getMqttMessages();
- Assert.assertEquals("listener did not recieve mqtt messages ", 1, mqttMessages.size());
+ Assert.assertEquals("listener did not recieve mqtt messages ", 0, mqttMessages.size());
String topicPub = automationContext.getContextTenant().getDomain() + "/"+deviceType+"/"+deviceId+"/events";
int qos = 2;
diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql
new file mode 100644
index 00000000..1ba2aeb0
--- /dev/null
+++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/android-migration.sql
@@ -0,0 +1,7 @@
+ALTER TABLE AD_DEVICE
+CHANGE COLUMN GCM_TOKEN FCM_TOKEN VARCHAR(1000) NULL DEFAULT NULL;
+
+-- Run the following only if the both EMM 2.1.0 and IoT 3.3.1 has to run simultaneously.
+
+ALTER TABLE AD_DEVICE
+ADD COLUMN GCM_TOKEN VARCHAR(1000) NULL AFTER OS_BUILD_DATE;
diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql
new file mode 100644
index 00000000..5a54d7d4
--- /dev/null
+++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/cdm-migration.sql
@@ -0,0 +1,248 @@
+-- Before running this script, please make sure that DM_OPERATION does have the INITIATED_BY column. Some customers
+-- may have it because of a patch. But Some customers may not have it, therefore depending on the situation, please
+-- comment or uncomment one of first two ALTER TABLE DM_OPERATION SQL commands.
+
+-- ALTER TABLE DM_OPERATION
+-- ADD COLUMN INITIATED_BY VARCHAR(100) NULL DEFAULT NULL AFTER OPERATION_CODE;
+
+ALTER TABLE DM_OPERATION
+CHANGE COLUMN INITIATED_BY INITIATED_BY VARCHAR(100) NULL DEFAULT NULL;
+
+ALTER TABLE DM_PROFILE
+DROP FOREIGN KEY DM_PROFILE_DEVICE_TYPE;
+
+ALTER TABLE DM_DEVICE_TYPE_POLICY
+DROP FOREIGN KEY FK_DEVICE_TYPE_POLICY_DEVICE_TYPE;
+
+
+ALTER TABLE DM_DEVICE_TYPE
+ADD COLUMN DEVICE_TYPE_META VARCHAR(20000) NULL AFTER NAME,
+ADD COLUMN LAST_UPDATED_TIMESTAMP TIMESTAMP NULL AFTER DEVICE_TYPE_META;
+
+
+CREATE INDEX IDX_DEVICE_TYPE_PROVIDER ON DM_DEVICE_TYPE (NAME, PROVIDER_TENANT_ID);
+CREATE INDEX IDX_DEVICE_TYPE_DEVICE_NAME ON DM_DEVICE_TYPE(ID, NAME);
+
+
+CREATE TABLE IF NOT EXISTS DM_GROUP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ GROUP_NAME VARCHAR(100) DEFAULT NULL,
+ DESCRIPTION TEXT DEFAULT NULL,
+ OWNER VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID)
+)
+ ENGINE = InnoDB;
+
+CREATE TABLE IF NOT EXISTS DM_ROLE_GROUP_MAP (
+ ID INTEGER AUTO_INCREMENT NOT NULL,
+ GROUP_ID INTEGER DEFAULT NULL,
+ ROLE VARCHAR(45) DEFAULT NULL,
+ TENANT_ID INTEGER DEFAULT 0,
+ PRIMARY KEY (ID),
+ CONSTRAINT DM_ROLE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+)
+ ENGINE = InnoDB;
+
+
+CREATE INDEX IDX_DM_DEVICE_TYPE_ID_DEVICE_IDENTIFICATION ON DM_DEVICE(TENANT_ID, DEVICE_TYPE_ID,DEVICE_IDENTIFICATION);
+
+CREATE TABLE IF NOT EXISTS DM_DEVICE_PROPERTIES (
+ DEVICE_TYPE_NAME VARCHAR(300) NOT NULL,
+ DEVICE_IDENTIFICATION VARCHAR(300) NOT NULL,
+ PROPERTY_NAME VARCHAR(100) DEFAULT 0,
+ PROPERTY_VALUE VARCHAR(100) DEFAULT NULL,
+ TENANT_ID VARCHAR(100),
+ PRIMARY KEY (DEVICE_TYPE_NAME, DEVICE_IDENTIFICATION, PROPERTY_NAME, TENANT_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 CASCADE
+ ON UPDATE CASCADE ,
+ CONSTRAINT fk_DM_DEVICE_GROUP_MAP_DM_GROUP2 FOREIGN KEY (GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+)
+ ENGINE = InnoDB;
+
+
+
+
+CREATE INDEX IDX_ENROLMENT_DEVICE_ID_TENANT_ID_STATUS ON DM_ENROLMENT(DEVICE_ID, TENANT_ID, STATUS);
+
+ALTER TABLE DM_ENROLMENT_OP_MAPPING
+ADD COLUMN PUSH_NOTIFICATION_STATUS VARCHAR(50) NULL AFTER STATUS;
+
+CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS);
+
+ALTER TABLE DM_DEVICE_APPLICATION_MAPPING
+ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID,
+ADD COLUMN APP_PROPERTIES BLOB NULL AFTER TENANT_ID,
+ADD COLUMN MEMORY_USAGE INT(11) NULL AFTER APP_PROPERTIES,
+ADD COLUMN IS_ACTIVE TINYINT NULL AFTER MEMORY_USAGE;
+
+SET SQL_SAFE_UPDATES = 0;
+
+UPDATE DM_DEVICE_APPLICATION_MAPPING dam,
+ DM_ENROLMENT de,
+ DM_APPLICATION da
+SET
+ dam.ENROLMENT_ID = de.ID,
+ dam.MEMORY_USAGE = da.MEMORY_USAGE,
+ dam.APP_PROPERTIES = da.APP_PROPERTIES,
+ dam.IS_ACTIVE = da.IS_ACTIVE
+WHERE
+ dam.APPLICATION_ID = da.ID
+ AND dam.DEVICE_ID = de.DEVICE_ID
+ AND de.STATUS = 'ACTIVE';
+
+SET SQL_SAFE_UPDATES = 1;
+
+
+ALTER TABLE DM_DEVICE_APPLICATION_MAPPING
+CHANGE COLUMN IS_ACTIVE IS_ACTIVE TINYINT(4) NOT NULL ,
+ADD INDEX FK_DM_APP_MAP_DM_ENROL_idx (ENROLMENT_ID ASC);
+ALTER TABLE DM_DEVICE_APPLICATION_MAPPING
+ADD CONSTRAINT FK_DM_APP_MAP_DM_ENROL
+ FOREIGN KEY (ENROLMENT_ID)
+ REFERENCES DM_ENROLMENT (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+
+ALTER TABLE DM_DEVICE_GROUP_POLICY
+DROP FOREIGN KEY FK_DM_DEVICE_GROUP_DM_POLICY,
+DROP FOREIGN KEY FK_DM_DEVICE_GROUP_POLICY;
+ALTER TABLE DM_DEVICE_GROUP_POLICY
+ADD CONSTRAINT FK_DM_DEVICE_GROUP_DM_POLICY
+ FOREIGN KEY (POLICY_ID)
+ REFERENCES DM_POLICY (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ADD CONSTRAINT FK_DM_DEVICE_GROUP_POLICY
+ FOREIGN KEY (DEVICE_GROUP_ID)
+ REFERENCES DM_GROUP (ID)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE;
+
+
+ALTER TABLE DM_NOTIFICATION
+DROP FOREIGN KEY fk_dm_operation_notification;
+ALTER TABLE DM_NOTIFICATION
+CHANGE COLUMN OPERATION_ID OPERATION_ID INT(11) NULL ,
+ADD COLUMN LAST_UPDATED_TIMESTAMP TIMESTAMP NULL AFTER DESCRIPTION;
+
+
+ALTER TABLE DM_NOTIFICATION
+CHANGE COLUMN LAST_UPDATED_TIMESTAMP LAST_UPDATED_TIMESTAMP TIMESTAMP NOT NULL ;
+
+
+ALTER TABLE DM_DEVICE_INFO
+ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID;
+
+SET SQL_SAFE_UPDATES = 0;
+
+
+UPDATE DM_DEVICE_INFO di,
+ DM_ENROLMENT de
+SET
+ di.ENROLMENT_ID = de.ID
+WHERE
+ di.DEVICE_ID = de.DEVICE_ID
+ AND de.STATUS = 'ACTIVE';
+
+SET SQL_SAFE_UPDATES = 1;
+
+ALTER TABLE DM_DEVICE_INFO
+CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL,
+ADD INDEX DM_DEVICE_LOCATION_DM_ENROLLMENT_idx (ENROLMENT_ID ASC);
+ALTER TABLE DM_DEVICE_INFO
+ADD CONSTRAINT DM_DEVICE_LOCATION_DM_ENROLLMENT
+ FOREIGN KEY (ENROLMENT_ID)
+ REFERENCES DM_ENROLMENT (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+
+ALTER TABLE DM_DEVICE_LOCATION
+CHANGE COLUMN STREET1 STREET1 VARCHAR(255) NULL DEFAULT NULL ,
+CHANGE COLUMN STREET2 STREET2 VARCHAR(255) NULL DEFAULT NULL ,
+ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID,
+ADD COLUMN GEO_HASH VARCHAR(45) NULL AFTER UPDATE_TIMESTAMP,
+ADD INDEX DM_DEVICE_LOCATION_GEO_hashx (GEO_HASH ASC);
+
+
+SET SQL_SAFE_UPDATES = 0;
+
+
+UPDATE DM_DEVICE_LOCATION di,
+ DM_ENROLMENT de
+SET
+ di.ENROLMENT_ID = de.ID
+WHERE
+ di.DEVICE_ID = de.DEVICE_ID
+ AND de.STATUS = 'ACTIVE';
+
+SET SQL_SAFE_UPDATES = 1;
+
+ALTER TABLE DM_DEVICE_LOCATION
+CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL ,
+ADD INDEX DM_DEVICE_LOCATION_DM_ENROLLMENT_idx (ENROLMENT_ID ASC);
+ALTER TABLE DM_DEVICE_LOCATION
+ADD CONSTRAINT FK_DM_DEVICE_LOCATION_DM_ENROLLMENT
+ FOREIGN KEY (ENROLMENT_ID)
+ REFERENCES DM_ENROLMENT (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+
+ALTER TABLE DM_DEVICE_DETAIL
+CHANGE COLUMN CONNECTION_TYPE CONNECTION_TYPE VARCHAR(50) NULL DEFAULT NULL ,
+ADD COLUMN ENROLMENT_ID INT(11) NULL AFTER DEVICE_ID;
+
+
+SET SQL_SAFE_UPDATES = 0;
+
+
+UPDATE DM_DEVICE_DETAIL di,
+ DM_ENROLMENT de
+SET
+ di.ENROLMENT_ID = de.ID
+WHERE
+ di.DEVICE_ID = de.DEVICE_ID
+ AND de.STATUS = 'ACTIVE';
+
+SET SQL_SAFE_UPDATES = 1;
+
+ALTER TABLE DM_DEVICE_DETAIL
+CHANGE COLUMN ENROLMENT_ID ENROLMENT_ID INT(11) NOT NULL ,
+ADD INDEX FK_DM_ENROLMENT_DEVICE_DETAILS_idx (ENROLMENT_ID ASC);
+ALTER TABLE DM_DEVICE_DETAIL
+ADD CONSTRAINT FK_DM_ENROLMENT_DEVICE_DETAILS
+ FOREIGN KEY (ENROLMENT_ID)
+ REFERENCES DM_ENROLMENT (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION;
+
+
+
+-- TEMP TABLE REQUIRED FOR DATA ARCHIVAL JOB
+CREATE TABLE IF NOT EXISTS DM_ARCHIVED_OPERATIONS (
+ ID INTEGER NOT NULL,
+ CREATED_TIMESTAMP TIMESTAMP NOT NULL,
+ PRIMARY KEY (ID)
+)ENGINE = InnoDB;
+
+
+
diff --git a/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql
new file mode 100644
index 00000000..af596147
--- /dev/null
+++ b/modules/migration/migration-emm_2.1.0-to-iot_3.3.1/ios-migration.sql
@@ -0,0 +1,75 @@
+ALTER TABLE IOS_DEVICE
+CHANGE COLUMN UNLOCK_TOKEN UNLOCK_TOKEN VARCHAR(5000) NULL DEFAULT NULL;
+
+-- -----------------------------------------------------
+-- Table IOS_DEVICE_PROFILE
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS IOS_DEVICE_PROFILE (
+ ID INT NOT NULL AUTO_INCREMENT,
+ OPERATION_ID VARCHAR(10) NOT NULL,
+ OPERATION_CODE VARCHAR(1000) NULL,
+ PROFILE_ID VARCHAR(1000) NULL,
+ DEVICE_IDENTIFICATION VARCHAR(300) DEFAULT NULL,
+ PROPERTIES TEXT DEFAULT NULL,
+ PRIMARY KEY (ID)
+);
+
+-- -----------------------------------------------------
+-- Table IOS_ENROLLMENT_TOKEN
+-- -----------------------------------------------------
+CREATE TABLE IF NOT EXISTS IOS_ENROLLMENT_TOKEN (
+ TENANT_DOMAIN VARCHAR(255) NOT NULL,
+ CHALLENGE_TOKEN VARCHAR(45) NOT NULL,
+ DEVICE_ID VARCHAR(45) DEFAULT NULL,
+ ACCESS_TOKEN VARCHAR(100) NOT NULL,
+ REFRESH_TOKEN VARCHAR(100) NOT NULL,
+ USERNAME VARCHAR(255) NOT NULL,
+ CLIENT_CREDENTIALS VARCHAR(255) NOT NULL,
+ AGENT_AVAILABLE VARCHAR(10) NOT NULL,
+ UNIQUE (TENANT_DOMAIN, CHALLENGE_TOKEN),
+ PRIMARY KEY (CHALLENGE_TOKEN)
+) ENGINE = InnoDB;
+
+-- -----------------------------------------------------
+-- Table IOS_DEP_PROFILE
+-- -----------------------------------------------------
+CREATE TABLE IOS_DEP_PROFILE (
+ ID INT NOT NULL AUTO_INCREMENT,
+ UUID VARCHAR(100) DEFAULT NULL,
+ PROFILE_NAME VARCHAR(200) DEFAULT NULL,
+ TENANT_DOMAIN VARCHAR(255) NOT NULL,
+ PROFILE_CONTENT Text DEFAULT NULL,
+ UNIQUE (UUID),
+ PRIMARY KEY (ID)
+);
+
+-- -----------------------------------------------------
+-- Table IOS_PRE_ENROLLED_DEVICE
+-- -----------------------------------------------------
+CREATE TABLE IOS_PRE_ENROLLED_DEVICE (
+ ID INT NOT NULL AUTO_INCREMENT,
+ SERIAL VARCHAR(45) DEFAULT NULL,
+ DEVICE_IDENTIFIER VARCHAR(45) DEFAULT NULL,
+ USERNAME VARCHAR(255),
+ TENANT_DOMAIN VARCHAR(255) NOT NULL,
+ STATUS VARCHAR(100) DEFAULT NULL,
+ DEP_PROFILE_ID INT DEFAULT NULL,
+ PROFILE_ASSIGN_TIME TIMESTAMP NULL,
+ PROFILE_PUSH_TIME TIMESTAMP NULL,
+ DEVICE_ASSIGNED_TIME TIMESTAMP NULL,
+ DEVICE_ASSIGNED_BY VARCHAR(100) DEFAULT NULL,
+ NEED_BASIC_AUTH INT DEFAULT 0,
+ IS_AGENT_REQUIRED INT DEFAULT 0,
+ OS VARCHAR(45) DEFAULT NULL,
+ DEVICE_FAMILY VARCHAR(45) DEFAULT NULL,
+ DEVICE_MODEL VARCHAR(45) DEFAULT NULL,
+ DESCRIPTION VARCHAR(200) DEFAULT NULL,
+ COLOR VARCHAR(200) DEFAULT NULL,
+ UNIQUE (SERIAL),
+ PRIMARY KEY (ID),
+ CONSTRAINT fk_IOS_PRE_ENROLLED_DEVICE_IOS_DEP_PROFILE
+ FOREIGN KEY (DEP_PROFILE_ID)
+ REFERENCES IOS_DEP_PROFILE (ID)
+ ON DELETE NO ACTION
+ ON UPDATE NO ACTION
+);
\ No newline at end of file
diff --git a/modules/p2-profile/analytics-profile/pom.xml b/modules/p2-profile/analytics-profile/pom.xml
index 6faa5718..38cec19a 100644
--- a/modules/p2-profile/analytics-profile/pom.xml
+++ b/modules/p2-profile/analytics-profile/pom.xml
@@ -393,10 +393,6 @@
org.wso2.carbon.devicemgt:org.wso2.carbon.identity.jwt.client.extension.feature:${carbon.device.mgt.version}
-
-
- org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.iot.geo.dashboard.feature:${carbon.device.mgt.plugin.version}
-
org.wso2.carbon.analytics.shared:org.wso2.carbon.analytics.shared.spark.common.udf.feature:${analytics.shared.version}
@@ -410,9 +406,7 @@
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.device.mgt.plugin.version}
-
- org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature:${carbon.device.mgt.plugin.version}
-
+
org.wso2.carbon.devicemgt-plugins:org.wso2.gpl.siddhi.extension.geo.script.feature:${carbon.device.mgt.plugin.version}
@@ -863,16 +857,8 @@
org.wso2.carbon.analytics.gadget.template.feature.group
${carbon.analytics.common.version}
-
-
-
- org.wso2.carbon.iot.geo.dashboard.feature.group
- ${carbon.device.mgt.plugin.version}
-
-
-
org.wso2.extension.siddhi.execution.json.feature.group
@@ -882,16 +868,6 @@
org.wso2.extension.siddhi.device.feature.group
${carbon.device.mgt.plugin.version}
-
- org.wso2.carbon.device.mgt.iot.analytics.feature.group
- ${carbon.device.mgt.plugin.version}
-
-
-
-
- org.wso2.carbon.device.mgt.iot.androidsense.analytics.feature.group
- ${carbon.device.mgt.plugin.version}
-
org.wso2.gpl.siddhi.extension.geo.script.feature.group
diff --git a/modules/p2-profile/iot-core-profile/pom.xml b/modules/p2-profile/iot-core-profile/pom.xml
index 5ad52e1d..1478f926 100644
--- a/modules/p2-profile/iot-core-profile/pom.xml
+++ b/modules/p2-profile/iot-core-profile/pom.xml
@@ -137,7 +137,7 @@
org.wso2.carbon.devicemgt:org.wso2.carbon.apimgt.webapp.publisher.feature:${carbon.device.mgt.version}
- org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.data.publisher.feature:${carbon.device.mgt.version}
+ org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.analytics.feature:${carbon.device.mgt.version}
org.wso2.carbon.devicemgt:org.wso2.carbon.identity.jwt.client.extension.feature:${carbon.device.mgt.version}
@@ -180,12 +180,6 @@
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.mobile.windows.feature:${carbon.device.mgt.plugin.version}
-
-
- org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.ui.feature:${carbon.device.mgt.plugin.version}
-
-
- org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.androidsense.backend.feature:${carbon.device.mgt.plugin.version}
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.notification.listener.feature:${carbon.device.mgt.plugin.version}
@@ -777,7 +771,10 @@
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.iot.geo.dashboard.feature:${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.analytics.feature:${carbon.device.mgt.plugin.version}
+
@@ -1030,7 +1027,7 @@
${carbon.device.mgt.version}
- org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group
+ org.wso2.carbon.device.mgt.analytics.feature.group
${carbon.device.mgt.version}
@@ -1060,14 +1057,6 @@
org.wso2.carbon.device.mgt.mobile.windows.feature.group
${carbon.device.mgt.plugin.version}
-
-
- org.wso2.carbon.device.mgt.iot.androidsense.ui.feature.group
- ${carbon.device.mgt.plugin.version}
-
-
- org.wso2.carbon.device.mgt.iot.androidsense.backend.feature.group
- ${carbon.device.mgt.plugin.version}
org.wso2.carbon.device.mgt.notification.listener.feature.group
@@ -1721,7 +1710,11 @@
org.wso2.carbon.iot.geo.dashboard.feature.group
${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.device.mgt.iot.analytics.feature.group
+ ${carbon.device.mgt.plugin.version}
+
org.wso2.carbon.device.mgt.remote.session.feature.group
@@ -2120,7 +2113,7 @@
${carbon.consent.mgt.version}
- org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group
+ org.wso2.carbon.device.mgt.analytics.feature.group
${carbon.device.mgt.version}
@@ -2147,10 +2140,6 @@
org.wso2.carbon.device.mgt.mobile.android.feature.group
${carbon.device.mgt.plugin.version}
-
- org.wso2.carbon.device.mgt.iot.androidsense.ui.feature.group
- ${carbon.device.mgt.plugin.version}
-
org.wso2.carbon.device.mgt.mobile.windows.feature.group
${carbon.device.mgt.plugin.version}
@@ -2624,7 +2613,11 @@
org.wso2.carbon.iot.geo.dashboard.feature.group
${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.device.mgt.iot.analytics.feature.group
+ ${carbon.device.mgt.plugin.version}
+
org.wso2.carbon.device.mgt.remote.session.feature.group
@@ -2632,11 +2625,11 @@
-
-
- org.wso2.carbon.andes.extensions.device.mgt.api.feature.group
- ${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.andes.extensions.device.mgt.api.feature.group
+ ${carbon.device.mgt.plugin.version}
+
@@ -2765,7 +2758,7 @@
${carbon.device.mgt.version}
- org.wso2.carbon.device.mgt.analytics.data.publisher.feature.group
+ org.wso2.carbon.device.mgt.analytics.feature.group
${carbon.device.mgt.version}
@@ -2792,10 +2785,6 @@
org.wso2.carbon.device.mgt.mobile.android.feature.group
${carbon.device.mgt.plugin.version}
-
- org.wso2.carbon.device.mgt.iot.androidsense.backend.feature.group
- ${carbon.device.mgt.plugin.version}
-
org.wso2.carbon.device.mgt.mobile.windows.feature.group
${carbon.device.mgt.plugin.version}
@@ -3254,18 +3243,22 @@
org.wso2.carbon.iot.geo.dashboard.feature.group
${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.device.mgt.iot.analytics.feature.group
+ ${carbon.device.mgt.plugin.version}
+
org.wso2.carbon.device.mgt.remote.session.feature.group
${carbon.device.mgt.plugin.version}
-
-
- org.wso2.carbon.andes.extensions.device.mgt.api.feature.group
- ${carbon.device.mgt.plugin.version}
-
+
+
+ org.wso2.carbon.andes.extensions.device.mgt.api.feature.group
+ ${carbon.device.mgt.plugin.version}
+