From b5548f5744feedc741ea0923f7c8fe36d3f5269c Mon Sep 17 00:00:00 2001 From: prabathabey Date: Wed, 28 Oct 2015 17:55:26 +0530 Subject: [PATCH] Adding postgreSQL and Oracle schemas for plugin specific datastores and refactoring existing schemas to be consistent across that of all available plugin types --- .../dao/impl/WindowsDeviceDAOImpl.java | 29 ++++---- .../windows/util/WindowsPluginConstants.java | 2 +- .../src/test/resources/sql/h2.sql | 6 +- .../dbscripts/plugins/android/h2.sql | 30 ++++++++ .../{mysql_android.sql => android/mysql.sql} | 4 +- .../dbscripts/plugins/android/oracle.sql | 49 +++++++++++++ .../dbscripts/plugins/android/postgres.sql | 30 ++++++++ .../dbscripts/plugins/h2_android.sql | 56 --------------- .../resources/dbscripts/plugins/h2_ios.sql | 69 ------------------- .../dbscripts/plugins/h2_windows.sql | 65 ----------------- .../resources/dbscripts/plugins/ios/h2.sql | 33 +++++++++ .../plugins/{mysql_ios.sql => ios/mysql.sql} | 33 ++++----- .../dbscripts/plugins/ios/oracle.sql | 51 ++++++++++++++ .../dbscripts/plugins/ios/postgres.sql | 33 +++++++++ .../dbscripts/plugins/mysql_windows.sql | 52 -------------- .../dbscripts/plugins/windows/h2.sql | 30 ++++++++ .../dbscripts/plugins/windows/mysql.sql | 48 +++++++++++++ .../dbscripts/plugins/windows/oracle.sql | 64 +++++++++++++++++ .../dbscripts/plugins/windows/postgres.sql | 45 ++++++++++++ 19 files changed, 447 insertions(+), 282 deletions(-) create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql rename features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/{mysql_android.sql => android/mysql.sql} (96%) create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgres.sql delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_ios.sql delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql rename features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/{mysql_ios.sql => ios/mysql.sql} (84%) create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgres.sql delete mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgres.sql diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java index 237f88168..d9902cb7b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsDeviceDAOImpl.java @@ -15,7 +15,6 @@ * specific language governing permissions and limitations * under the License. */ - package org.wso2.carbon.device.mgt.mobile.impl.windows.dao.impl; import org.apache.commons.logging.Log; @@ -52,17 +51,17 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { try { conn = WindowsDAOFactory.getConnection(); String selectDBQuery = - "SELECT MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " + + "SELECT DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " + "OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS," + " OS_VERSION, DEVICE_NAME " + - "FROM WINDOWS_DEVICE WHERE MOBILE_DEVICE_ID = ?"; + "FROM WIN_DEVICE WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(selectDBQuery); stmt.setString(1, mblDeviceId); rs = stmt.executeQuery(); while (rs.next()) { mobileDevice = new MobileDevice(); - mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.MOBILE_DEVICE_ID)); + mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID)); mobileDevice.setImei(rs.getString(WindowsPluginConstants.IMEI)); mobileDevice.setImsi(rs.getString(WindowsPluginConstants.IMSI)); mobileDevice.setModel(rs.getString(WindowsPluginConstants.DEVICE_MODEL)); @@ -72,7 +71,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { mobileDevice.setSerial(rs.getString(WindowsPluginConstants.SERIAL)); mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE)); - Map propertyMap = new HashMap(); + Map propertyMap = new HashMap<>(); propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI)); propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO)); propertyMap.put(WindowsPluginConstants.MAC_ADDRESS, rs.getString(WindowsPluginConstants.MAC_ADDRESS)); @@ -99,7 +98,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { try { conn = WindowsDAOFactory.getConnection(); String createDBQuery = - "INSERT INTO WINDOWS_DEVICE(MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, " + + "INSERT INTO WIN_DEVICE(DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, " + "IMSI, OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, " + "MAC_ADDRESS, DEVICE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; @@ -139,14 +138,14 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { @Override public boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException { boolean status = false; - Connection conn = null; + Connection conn; PreparedStatement stmt = null; try { conn = WindowsDAOFactory.getConnection(); String updateDBQuery = - "UPDATE WINDOWS_DEVICE SET CHANNEL_URI = ?, DEVICE_INFO = ?, IMEI = ?, IMSI = ?, " + + "UPDATE WIN_DEVICE SET CHANNEL_URI = ?, DEVICE_INFO = ?, IMEI = ?, IMSI = ?, " + "OS_VERSION = ?, DEVICE_MODEL = ?, VENDOR = ?, LATITUDE = ?, LONGITUDE = ?, " + - "SERIAL = ?, MAC_ADDRESS = ?, DEVICE_NAME = ? WHERE MOBILE_DEVICE_ID = ?"; + "SERIAL = ?, MAC_ADDRESS = ?, DEVICE_NAME = ? WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(updateDBQuery); @@ -188,7 +187,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { PreparedStatement stmt = null; try { conn = WindowsDAOFactory.getConnection(); - String deleteDBQuery = "DELETE FROM WINDOWS_DEVICE WHERE MOBILE_DEVICE_ID = ?"; + String deleteDBQuery = "DELETE FROM WIN_DEVICE WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(deleteDBQuery); stmt.setString(1, mblDeviceId); int rows = stmt.executeUpdate(); @@ -214,20 +213,20 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { PreparedStatement stmt = null; ResultSet rs = null; MobileDevice mobileDevice; - List mobileDevices = new ArrayList(); + List mobileDevices = new ArrayList<>(); try { conn = WindowsDAOFactory.getConnection(); String selectDBQuery = - "SELECT MOBILE_DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " + + "SELECT DEVICE_ID, CHANNEL_URI, DEVICE_INFO, IMEI, IMSI, " + "OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS," + " OS_VERSION, DEVICE_NAME " + - "FROM WINDOWS_DEVICE"; + "FROM WIN_DEVICE"; stmt = conn.prepareStatement(selectDBQuery); rs = stmt.executeQuery(); while (rs.next()) { mobileDevice = new MobileDevice(); - mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.MOBILE_DEVICE_ID)); + mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID)); mobileDevice.setVendor(rs.getString(WindowsPluginConstants.IMEI)); mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI)); mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION)); @@ -235,7 +234,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO { mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR)); mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE)); - Map propertyMap = new HashMap(); + Map propertyMap = new HashMap<>(); propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI)); propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO)); propertyMap.put(WindowsPluginConstants.DEVICE_NAME, rs.getString(WindowsPluginConstants.DEVICE_NAME)); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java index 50f8f15c3..853e5d435 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java @@ -24,7 +24,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows.util; public class WindowsPluginConstants { //properties related to database table WINDOWS_DEVICE - public static final String MOBILE_DEVICE_ID = "MOBILE_DEVICE_ID"; + public static final String DEVICE_ID = "DEVICE_ID"; public static final String CHANNEL_URI = "CHANNEL_URI"; public static final String DEVICE_INFO = "DEVICE_INFO"; public static final String IMEI = "IMEI"; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql index e10ec1da8..58210317e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/test/resources/sql/h2.sql @@ -3,7 +3,7 @@ -- Table `AD_DEVICE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( - `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL , + `DEVICE_ID` VARCHAR(45) NOT NULL , `PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL , `IMEI` VARCHAR(45) NULL DEFAULT NULL , `IMSI` VARCHAR(45) NULL DEFAULT NULL , @@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( `TOKEN` VARCHAR(500) NULL DEFAULT NULL, `UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`MOBILE_DEVICE_ID`) ); + PRIMARY KEY (`DEVICE_ID`) ); -- ----------------------------------------------------- @@ -51,7 +51,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE_OPERATION_MAPPING` ( PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) , CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_DEVICE` FOREIGN KEY (`DEVICE_ID` ) - REFERENCES `AD_DEVICE` (`MOBILE_DEVICE_ID` ) + REFERENCES `AD_DEVICE` (`DEVICE_ID` ) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_OPERATION1` diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql new file mode 100644 index 000000000..1f280205c --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/h2.sql @@ -0,0 +1,30 @@ + +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( + `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL, + `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`ANDROID_DEVICE_ID`)); + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( + `ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`)); + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql similarity index 96% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql index 2c5ed863c..ce25caf6e 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/mysql.sql @@ -1,5 +1,5 @@ -- ----------------------------------------------------- --- Table `MBL_DEVICE` +-- Table `AD_DEVICE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , @@ -20,7 +20,7 @@ ENGINE = InnoDB; -- ----------------------------------------------------- --- Table `MBL_FEATURE` +-- Table `AD_FEATURE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( `ID` INT NOT NULL AUTO_INCREMENT, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql new file mode 100644 index 000000000..b8a522b90 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/oracle.sql @@ -0,0 +1,49 @@ +-- ----------------------------------------------------- +-- Table `AD_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE AD_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL , + DEVICE_INFO VARCHAR(500) DEFAULT NULL, + GCM_TOKEN VARCHAR(45) DEFAULT NULL, + IMEI VARCHAR(45) DEFAULT NULL, + IMSI VARCHAR(45) DEFAULT NULL, + OS_VERSION VARCHAR(45) DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) DEFAULT NULL, + VENDOR VARCHAR(45) DEFAULT NULL, + LATITUDE VARCHAR(45) DEFAULT NULL, + LONGITUDE VARCHAR(45) DEFAULT NULL, + SERIAL VARCHAR(45) DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) DEFAULT NULL, + DEVICE_NAME VARCHAR(100) DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) +); +/ + +-- ----------------------------------------------------- +-- Table `AD_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE AD_FEATURE ( + ID INT NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NOT NULL, + DESCRIPTION VARCHAR(200) DEFAULT NULL, + PRIMARY KEY (ID) +); +/ + +-- ----------------------------------------------------- +-- Sequence `AD_FEATURE_ID_INC_SEQ` +-- ----------------------------------------------------- +CREATE SEQUENCE AD_FEATURE_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE; +/ + +-- ----------------------------------------------------- +-- Trigger `AD_FEATURE_ID_INC_TRIG` +-- ----------------------------------------------------- +CREATE OR REPLACE TRIGGER AD_FEATURE_ID_INC_TRIG +BEFORE INSERT ON AD_FEATURE +FOR EACH ROW +BEGIN + SELECT AD_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; +END; +/ diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgres.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgres.sql new file mode 100644 index 000000000..af5c9a5cf --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/android/postgres.sql @@ -0,0 +1,30 @@ +-- ----------------------------------------------------- +-- Table AD_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AD_DEVICE ( + ID VARCHAR(45) NOT NULL , + DEVICE_INFO VARCHAR(500) NULL DEFAULT NULL, + GCM_TOKEN VARCHAR(45) NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (ID) + ); + +-- ----------------------------------------------------- +-- Table AD_FEATURE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS AD_FEATURE ( + ID INT NOT NULL AUTO_INCREMENT, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql deleted file mode 100644 index 3cef91277..000000000 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql +++ /dev/null @@ -1,56 +0,0 @@ - --- ----------------------------------------------------- --- Table `AD_DEVICE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( - `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL, - `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, - `IMEI` VARCHAR(45) NULL DEFAULT NULL, - `IMSI` VARCHAR(45) NULL DEFAULT NULL, - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, - `VENDOR` VARCHAR(45) NULL DEFAULT NULL, - `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, - `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, - `SERIAL` VARCHAR(45) NULL DEFAULT NULL, - `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, - PRIMARY KEY (`ANDROID_DEVICE_ID`)); - --- ----------------------------------------------------- --- Table `AD_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( - `ID` INT NOT NULL AUTO_INCREMENT, - `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL, - `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`ID`)); - - --- ----------------------------------------------------- --- TODO remove this later --- ----------------------------------------------------- - -INSERT INTO AD_FEATURE (CODE, NAME, DESCRIPTION) -VALUES -('DEVICE_LOCK', 'Device Lock', 'Lock the device'), -('DEVICE_LOCATION', 'Location', 'Request coordinates of device location'), -('WIFI', 'Wifi', 'Setting up wifi configuration'), -('CAMERA', 'Camera', 'Enable or disable camera'), -('EMAIL', 'Email', 'Configure email settings'), -('DEVICE_MUTE', 'Mute', 'Enable mute in the device'), -('DEVICE_INFO', 'Device Info', 'Request device information'), -('ENTERPRISE_WIPE', 'Enterprise Wipe', 'Remove enterprise applications'), -('CLEAR_PASSWORD', 'Clear Password', 'Clear current password'), -('WIPE_DATA', 'Wipe Data', 'Factory reset the device'), -('APPLICATION_LIST', 'Application List', 'Request list of current installed applications'), -('CHANGE_LOCK_CODE', 'Change Lock-code', 'Change current lock code'), -('INSTALL_APPLICATION', 'Install App', 'Install Enterprise or Market application'), -('UNINSTALL_APPLICATION', 'Uninstall App', 'Uninstall application'), -('BLACKLIST_APPLICATIONS', 'Blacklist app', 'Blacklist applications'), -('ENCRYPT_STORAGE', 'Encrypt storage', 'Encrypt storage'), -('DEVICE_RING', 'Ring', 'Ring the device'), -('PASSCODE_POLICY', 'Password Policy', 'Set passcode policy'), -('NOTIFICATION', 'Message', 'Send message'); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_ios.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_ios.sql deleted file mode 100644 index 52f30b57e..000000000 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_ios.sql +++ /dev/null @@ -1,69 +0,0 @@ --- ----------------------------------------------------- --- Table `IOS_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `IOS_FEATURE` ( - `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL, - `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`) ); - - --- ----------------------------------------------------- --- Table `IOS_DEVICE` --- ----------------------------------------------------- - - CREATE TABLE IF NOT EXISTS `IOS_DEVICE` ( - `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, - `APNS_PUSH_TOKEN` VARCHAR(100) DEFAULT NULL, - `MAGIC_TOKEN` VARCHAR(100) DEFAULT NULL, - `MDM_TOKEN` VARCHAR(100) DEFAULT NULL, - `UNLOCK_TOKEN` VARCHAR(2000) DEFAULT NULL, - `CHALLENGE_TOKEN` VARCHAR(45) DEFAULT NULL, - `DEVICE_INFO` VARCHAR(8000) DEFAULT NULL, - `SERIAL` VARCHAR(45) DEFAULT NULL, - `PRODUCT` VARCHAR(45) DEFAULT NULL, - `IMEI` VARCHAR(45) DEFAULT NULL, - `VERSION` VARCHAR(45) DEFAULT NULL, - `MAC_ADDRESS` VARCHAR(45) DEFAULT NULL, - `DEVICE_NAME` VARCHAR(100) DEFAULT NULL, - `ICCID` VARCHAR(45) DEFAULT NULL, - `LATITUDE` VARCHAR(45) DEFAULT NULL, - `LONGITUDE` VARCHAR(45) DEFAULT NULL, - PRIMARY KEY (`MOBILE_DEVICE_ID`) ); - - --- ----------------------------------------------------- --- TODO remove this later --- ----------------------------------------------------- - -INSERT INTO IOS_FEATURE (CODE, NAME, DESCRIPTION) -VALUES -('INSTALL_ENTERPRISE_APPLICATION', 'Install Enterprise App', 'Install Enterprise App'), -
('INSTALL_STORE_APPLICATION', 'Install Public App', 'Install Public App'), 
 -('REMOVE_APPLICATION', 'Uninstall App', 'Uninstall App'), -
('DEVICE_LOCK', 'Device Lock', 'Device Lock'), -
('CELLULAR', 'Cellular', 'Cellular'), -
('APN', 'APN', 'APN'), -
('RESTRICTION', 'Restrictions', 'Restrictions operation'), -
('WIFI', 'Wifi', 'Wifi'), -
('DEVICE_INFO', 'Device Info', 'Device info operation'), 
 -('AIR_PLAY', 'Air Play', 'AirPlay operation'), 
 -('LOCATION', 'Location', 'Fetch location'), 
 -('ALARM', 'Alarm', 'Alarm device'), -('APPLICATION_LIST', 'Application list', 'Application list'), -('PROFILE_LIST', 'Profile List', 'Profile list'), -('REMOVE_PROFILE', 'Remove Profile', 'Remove profile'), -('CLEAR_PASSCODE', 'Clear Passcode', 'Clear passcode'), -('CALDAV', 'CalDev', 'Setup CalDav'), -('CALENDAR_SUBSCRIPTION', 'Calendar Subscriptions', 'Calendar subscription'), -('PASSCODE_POLICY', 'Passcode Policy', 'Passcode policy'), -('EMAIL', 'Email', 'Email operation'), -('LDAP', 'LDAP', 'LDAP operation'), -('WEB_CLIP', 'Web Clip', 'Web clip operation'), -('VPN', 'VPN', 'VPN operation'), -('PER_APP_VPN', 'Per App VPN', 'Per app VPN operation'), -('APP_TO_PER_APP_VPN_MAPPING', 'VPN App mapping', 'App to per app VPN mapping operation'), -('ENTERPRISE_WIPE', 'Enterprise Wipe', 'Enterprise wipe operation'), -('APP_LOCK', 'App lock', 'App lock operation'), -('GET_RESTRICTIONS', 'Get restrictions', 'Get restrictions operation'); \ No newline at end of file diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql deleted file mode 100644 index 638f3bf67..000000000 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql +++ /dev/null @@ -1,65 +0,0 @@ --- ----------------------------------------------------- --- Table `WINDOWS_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `WINDOWS_FEATURE` ( - `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL, - `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`)); - - --- ----------------------------------------------------- --- Table `WINDOWS_DEVICE` --- ----------------------------------------------------- - - CREATE TABLE IF NOT EXISTS `WINDOWS_DEVICE` ( - `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, - `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL, - `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, - `IMEI` VARCHAR(45) NULL DEFAULT NULL, - `IMSI` VARCHAR(45) NULL DEFAULT NULL, - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, - `VENDOR` VARCHAR(45) NULL DEFAULT NULL, - `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, - `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, - `SERIAL` VARCHAR(45) NULL DEFAULT NULL, - `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, - PRIMARY KEY (`MOBILE_DEVICE_ID`) ); - - --- ----------------------------------------------------- --- TODO remove this later --- ----------------------------------------------------- - -INSERT INTO WINDOWS_FEATURE (CODE, NAME, DESCRIPTION) -VALUES -('INSTALL_ENTERPRISE_APPLICATION', 'Install Enterprise App', 'Install Enterprise App'), -
('INSTALL_STORE_APPLICATION', 'Install Public App', 'Install Public App'), 
 -('REMOVE_APPLICATION', 'Uninstall App', 'Uninstall App'), -
('DEVICE_LOCK', 'Device Lock', 'Device Lock'), -
('CELLULAR', 'Cellular', 'Cellular'), -
('APN', 'APN', 'APN'), -
('RESTRICTION', 'Restrictions', 'Restrictions operation'), -
('WIFI', 'Wifi', 'Wifi'), -
('DEVICE_INFO', 'Device Info', 'Device info operation'), 
 -('AIR_PLAY', 'Air Play', 'AirPlay operation'), 
 -('LOCATION', 'Location', 'Fetch location'), 
 -('ALARM', 'Alarm', 'Alarm device'), -('APPLICATION_LIST', 'Application list', 'Application list'), -('PROFILE_LIST', 'Profile List', 'Profile list'), -('REMOVE_PROFILE', 'Remove Profile', 'Remove profile'), -('CLEAR_PASSCODE', 'Clear Passcode', 'Clear passcode'), -('CALDAV', 'CalDev', 'Setup CalDav'), -('CALENDAR_SUBSCRIPTION', 'Calendar Subscriptions', 'Calendar subscription'), -('PASSCODE_POLICY', 'Passcode Policy', 'Passcode policy'), -('EMAIL', 'Email', 'Email operation'), -('LDAP', 'LDAP', 'LDAP operation'), -('WEB_CLIP', 'Web Clip', 'Web clip operation'), -('VPN', 'VPN', 'VPN operation'), -('PER_APP_VPN', 'Per App VPN', 'Per app VPN operation'), -('APP_TO_PER_APP_VPN_MAPPING', 'VPN App mapping', 'App to per app VPN mapping operation'), -('ENTERPRISE_WIPE', 'Enterprise Wipe', 'Enterprise wipe operation'), -('APP_LOCK', 'App lock', 'App lock operation'); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql new file mode 100644 index 000000000..c9c70ce2d --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/h2.sql @@ -0,0 +1,33 @@ +-- ----------------------------------------------------- +-- Table `IOS_DEVICE` +-- ----------------------------------------------------- + CREATE TABLE IF NOT EXISTS `IOS_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `APNS_PUSH_TOKEN` VARCHAR(100) DEFAULT NULL, + `MAGIC_TOKEN` VARCHAR(100) DEFAULT NULL, + `MDM_TOKEN` VARCHAR(100) DEFAULT NULL, + `UNLOCK_TOKEN` VARCHAR(2000) DEFAULT NULL, + `CHALLENGE_TOKEN` VARCHAR(45) DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) DEFAULT NULL, + `SERIAL` VARCHAR(45) DEFAULT NULL, + `PRODUCT` VARCHAR(45) DEFAULT NULL, + `IMEI` VARCHAR(45) DEFAULT NULL, + `VERSION` VARCHAR(45) DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) DEFAULT NULL, + `ICCID` VARCHAR(45) DEFAULT NULL, + `LATITUDE` VARCHAR(45) DEFAULT NULL, + `LONGITUDE` VARCHAR(45) DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`) +); + +-- ----------------------------------------------------- +-- Table `IOS_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `IOS_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`FEATURE_ID`) +); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_ios.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql similarity index 84% rename from features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_ios.sql rename to features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql index 1b90f68c6..c71a33254 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_ios.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/mysql.sql @@ -1,21 +1,8 @@ --- ----------------------------------------------------- --- Table `IOS_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `IOS_FEATURE` ( - `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL, - `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`) ) - ENGINE = InnoDB; - - -- ----------------------------------------------------- -- Table `IOS_DEVICE` -- ----------------------------------------------------- - - CREATE TABLE IF NOT EXISTS `IOS_DEVICE` ( - `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, +CREATE TABLE IF NOT EXISTS `IOS_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, `APNS_PUSH_TOKEN` VARCHAR(100) NULL DEFAULT NULL, `MAGIC_TOKEN` VARCHAR(100) NULL DEFAULT NULL, `MDM_TOKEN` VARCHAR(100) NULL DEFAULT NULL, @@ -31,8 +18,16 @@ CREATE TABLE IF NOT EXISTS `IOS_FEATURE` ( `ICCID` VARCHAR(45) NULL DEFAULT NULL, `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`MOBILE_DEVICE_ID`) ) - ENGINE = InnoDB; - + PRIMARY KEY (`DEVICE_ID`) +) ENGINE = InnoDB; -long +-- ----------------------------------------------------- +-- Table `IOS_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `IOS_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`FEATURE_ID`) +) ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql new file mode 100644 index 000000000..11e5212e1 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/oracle.sql @@ -0,0 +1,51 @@ +-- ----------------------------------------------------- +-- Table `IOS_DEVICE` +-- ----------------------------------------------------- + CREATE TABLE IOS_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + APNS_PUSH_TOKEN VARCHAR(100) DEFAULT NULL, + MAGIC_TOKEN VARCHAR(100) DEFAULT NULL, + MDM_TOKEN VARCHAR(100) DEFAULT NULL, + UNLOCK_TOKEN VARCHAR(2000) DEFAULT NULL, + CHALLENGE_TOKEN VARCHAR(45) DEFAULT NULL, + DEVICE_INFO VARCHAR(8000) DEFAULT NULL, + SERIAL VARCHAR(45) DEFAULT NULL, + PRODUCT VARCHAR(45) DEFAULT NULL, + IMEI VARCHAR(45) DEFAULT NULL, + VERSION VARCHAR(45) DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) DEFAULT NULL, + DEVICE_NAME VARCHAR(100) DEFAULT NULL, + ICCID VARCHAR(45) DEFAULT NULL, + LATITUDE VARCHAR(45) DEFAULT NULL, + LONGITUDE VARCHAR(45) DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) +); +/ + +-- ----------------------------------------------------- +-- Table `IOS_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IOS_FEATURE ( + ID INT NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NOT NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); +/ + +-- Sequence `IOS_FEATURE_ID_INC_SEQ` +-- ----------------------------------------------------- +CREATE SEQUENCE IOS_FEATURE_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE; +/ + +-- ----------------------------------------------------- +-- Trigger `IOS_FEATURE_ID_INC_TRIG` +-- ----------------------------------------------------- +CREATE OR REPLACE TRIGGER IOS_FEATURE_ID_INC_TRIG +BEFORE INSERT ON IOS_FEATURE +FOR EACH ROW +BEGIN + SELECT IOS_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; +END; +/ diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgres.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgres.sql new file mode 100644 index 000000000..79b342ca3 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/ios/postgres.sql @@ -0,0 +1,33 @@ +-- ----------------------------------------------------- +-- Table IOS_FEATURE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS IOS_FEATURE ( + ID SERIAL NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); + +-- ----------------------------------------------------- +-- Table IOS_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS IOS_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + APNS_PUSH_TOKEN VARCHAR(100) NULL DEFAULT NULL, + MAGIC_TOKEN VARCHAR(100) NULL DEFAULT NULL, + MDM_TOKEN VARCHAR(100) NULL DEFAULT NULL, + UNLOCK_TOKEN VARCHAR(2000) NULL DEFAULT NULL, + CHALLENGE_TOKEN VARCHAR(45) NULL DEFAULT NULL, + DEVICE_INFO VARCHAR(8000) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + PRODUCT VARCHAR(45) NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + VERSION VARCHAR(45) NULL DEFAULT NULL, + MAC_ADDRESS VARCHAR(45) NULL DEFAULT NULL, + DEVICE_NAME VARCHAR(100) NULL DEFAULT NULL, + ICCID VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) + ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql deleted file mode 100644 index dfabdc009..000000000 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql +++ /dev/null @@ -1,52 +0,0 @@ --- ----------------------------------------------------- --- Table `MBL_DEVICE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( - `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, - `PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL, - `IMEI` VARCHAR(45) NULL DEFAULT NULL, - `IMSI` VARCHAR(45) NULL DEFAULT NULL, - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, - `VENDOR` VARCHAR(45) NULL DEFAULT NULL, - `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, - `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, - `CHALLENGE` VARCHAR(45) NULL DEFAULT NULL, - `TOKEN` VARCHAR(50) NULL DEFAULT NULL, - `UNLOCK_TOKEN` VARCHAR(2000) NULL DEFAULT NULL, - `SERIAL` VARCHAR(45) NULL DEFAULT NULL, - PRIMARY KEY (`MOBILE_DEVICE_ID`)) -ENGINE = InnoDB; - - --- ----------------------------------------------------- --- Table `MBL_FEATURE` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( - `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `DEVICE_TYPE` VARCHAR(45) NOT NULL, - `CODE` VARCHAR(45) NULL, - `NAME` VARCHAR(100) NULL, - `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`)) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Table `MBL_FEATURE_PROPERTY` --- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` ( - `PROPERTY` VARCHAR(45) NOT NULL , - `FEATURE_ID` INT NOT NULL , - PRIMARY KEY (`PROPERTY`), - CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1` - FOREIGN KEY (`FEATURE_ID`) - REFERENCES `MBL_FEATURE` (`FEATURE_ID`) - ON DELETE NO ACTION - ON UPDATE NO ACTION) -ENGINE = InnoDB; - --- ----------------------------------------------------- --- Inserts --- ----------------------------------------------------- -INSERT INTO MBL_FEATURE (DEVICE_TYPE,NAME,CODE, DESCRIPTION) VALUES ('android','DEVICE_LOCK','503A','Device Lock'),('android','WIPE','504A','Device Wipe'),('android','CLEARPASSCODE','505A','Clear Passcode'),('android','APPLIST','502A','Get All Applications'),('android','LOCATION','501A','Location'),('android','INFO','500A','Device Information'),('android','NOTIFICATION','506A','Message'),('android','WIFI','507A','Setup Wifi'),('android','CAMERA','508A','Camera Control'),('android','MUTE','513A','Mute Device'),('android','INSTALLAPP','509A','Install Application'),('android','UNINSTALLAPP','510A','Uninstall Application'),('android','ENCRYPT','511A','Encrypt Storage'),('android','APN','512A','APN'),('android','WEBCLIP','518A','Create Webclips'),('android','PASSWORDPOLICY','519A','Passcode Policy'),('android','EMAIL','520A','Email Configuration'),('android','GOOGLECALENDAR','521A','Calender Subscription'),('android','VPN','523A','VPN'),('android','LDAP','524A','LDAP'),('android','CHANGEPASSWORD','526A','Set Passcode'),('android','ENTERPRISEWIPE','527A','Enterprise Wipe'),('android','POLICY','500P','Policy Enforcement'),('android','MONITORING','501P','Policy Monitoring '),('android','BLACKLISTAPPS','528B','Blacklist Apps'),('android','REVOKEPOLICY','502P','Revoke Policy'); - diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql new file mode 100644 index 000000000..3954f3c5e --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql @@ -0,0 +1,30 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- + CREATE TABLE IF NOT EXISTS `WIN_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`) +); + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, + `CODE` VARCHAR(45) NOT NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`FEATURE_ID`) +); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql new file mode 100644 index 000000000..ecdacf5b9 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql @@ -0,0 +1,48 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_DEVICE` ( + `DEVICE_ID` VARCHAR(45) NOT NULL, + `PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, + `CHALLENGE` VARCHAR(45) NULL DEFAULT NULL, + `TOKEN` VARCHAR(50) NULL DEFAULT NULL, + `UNLOCK_TOKEN` VARCHAR(2000) NULL DEFAULT NULL, + `SERIAL` VARCHAR(45) NULL DEFAULT NULL, + PRIMARY KEY (`DEVICE_ID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, + `DEVICE_TYPE` VARCHAR(45) NOT NULL, + `CODE` VARCHAR(45) NULL, + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`FEATURE_ID`)) +ENGINE = InnoDB; + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE_PROPERTY` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `WIN_FEATURE_PROPERTY` ( + `PROPERTY` VARCHAR(45) NOT NULL , + `FEATURE_ID` INT NOT NULL , + PRIMARY KEY (`PROPERTY`), + CONSTRAINT `fk_WIN_FEATURE_PROPERTY_WIN_FEATURE1` + FOREIGN KEY (`FEATURE_ID`) + REFERENCES `WIN_FEATURE` (`FEATURE_ID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql new file mode 100644 index 000000000..505330b66 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql @@ -0,0 +1,64 @@ +-- ----------------------------------------------------- +-- Table `WIN_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE WIN_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + PUSH_TOKEN VARCHAR(45) DEFAULT NULL, + IMEI VARCHAR(45) DEFAULT NULL, + IMSI VARCHAR(45) DEFAULT NULL, + OS_VERSION VARCHAR(45) DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) DEFAULT NULL, + VENDOR VARCHAR(45) DEFAULT NULL, + LATITUDE VARCHAR(45) DEFAULT NULL, + LONGITUDE VARCHAR(45) DEFAULT NULL, + CHALLENGE VARCHAR(45) DEFAULT NULL, + TOKEN VARCHAR(50) DEFAULT NULL, + UNLOCK_TOKEN VARCHAR(2000) DEFAULT NULL, + SERIAL VARCHAR(45) DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) +); +/ + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE WIN_FEATURE ( + ID INT NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + CODE VARCHAR(45) NOT NULL, + NAME VARCHAR(100) NOT NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) +); +/ + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE_PROPERTY` +-- ----------------------------------------------------- +CREATE TABLE WIN_FEATURE_PROPERTY ( + PROPERTY VARCHAR(45) NOT NULL, + FEATURE_ID INT NOT NULL, + PRIMARY KEY (PROPERTY), + CONSTRAINT fk_WIN_FEATURE_PROPERTY_WIN_FEATURE1 + FOREIGN KEY (FEATURE_ID) + REFERENCES WIN_FEATURE (FEATURE_ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION); +/ + +-- ----------------------------------------------------- +-- Sequence `WIN_FEATURE_ID_INC_SEQ` +-- ----------------------------------------------------- +CREATE SEQUENCE WIN_FEATURE_ID_INC_SEQ START WITH 1 INCREMENT BY 1 NOCACHE; +/ + +-- ----------------------------------------------------- +-- Trigger `WIN_FEATURE_ID_INC_TRIG` +-- ----------------------------------------------------- +CREATE OR REPLACE TRIGGER WIN_FEATURE_ID_INC_TRIG +BEFORE INSERT ON WIN_FEATURE +FOR EACH ROW +BEGIN + SELECT WIN_FEATURE_ID_INC_SEQ.NEXTVAL INTO :NEW.ID FROM DUAL; +END; +/ diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgres.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgres.sql new file mode 100644 index 000000000..45754d06f --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgres.sql @@ -0,0 +1,45 @@ +-- ----------------------------------------------------- +-- Table WIN_DEVICE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS WIN_DEVICE ( + DEVICE_ID VARCHAR(45) NOT NULL, + PUSH_TOKEN VARCHAR(45) NULL DEFAULT NULL, + IMEI VARCHAR(45) NULL DEFAULT NULL, + IMSI VARCHAR(45) NULL DEFAULT NULL, + OS_VERSION VARCHAR(45) NULL DEFAULT NULL, + DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL, + VENDOR VARCHAR(45) NULL DEFAULT NULL, + LATITUDE VARCHAR(45) NULL DEFAULT NULL, + LONGITUDE VARCHAR(45) NULL DEFAULT NULL, + CHALLENGE VARCHAR(45) NULL DEFAULT NULL, + TOKEN VARCHAR(50) NULL DEFAULT NULL, + UNLOCK_TOKEN VARCHAR(2000) NULL DEFAULT NULL, + SERIAL VARCHAR(45) NULL DEFAULT NULL, + PRIMARY KEY (DEVICE_ID) + ); + +-- ----------------------------------------------------- +-- Table WIN_FEATURE +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS WIN_FEATURE ( + ID SERIAL NOT NULL, + DEVICE_TYPE VARCHAR(45) NOT NULL, + CODE VARCHAR(45) NULL, + NAME VARCHAR(100) NULL, + DESCRIPTION VARCHAR(200) NULL, + PRIMARY KEY (ID) + ); + +-- ----------------------------------------------------- +-- Table `WIN_FEATURE_PROPERTY` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS WIN_FEATURE_PROPERTY ( + PROPERTY VARCHAR(45) NOT NULL , + FEATURE_ID INT NOT NULL , + PRIMARY KEY (PROPERTY), + CONSTRAINT fk_WIN_FEATURE_PROPERTY_WIN_FEATURE1 + FOREIGN KEY (FEATURE_ID) + REFERENCES WIN_FEATURE (ID) + ON DELETE NO ACTION + ON UPDATE NO ACTION +);