Adding postgreSQL and Oracle schemas for plugin specific datastores and refactoring existing schemas to be consistent across that of all available plugin types

revert-dabc3590
prabathabey 9 years ago
parent c47ace254c
commit b5548f5744

@ -15,7 +15,6 @@
* specific language governing permissions and limitations * specific language governing permissions and limitations
* under the License. * under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.windows.dao.impl; package org.wso2.carbon.device.mgt.mobile.impl.windows.dao.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -52,17 +51,17 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
try { try {
conn = WindowsDAOFactory.getConnection(); conn = WindowsDAOFactory.getConnection();
String selectDBQuery = 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_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS," +
" OS_VERSION, DEVICE_NAME " + " OS_VERSION, DEVICE_NAME " +
"FROM WINDOWS_DEVICE WHERE MOBILE_DEVICE_ID = ?"; "FROM WIN_DEVICE WHERE DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
while (rs.next()) { while (rs.next()) {
mobileDevice = new MobileDevice(); 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.setImei(rs.getString(WindowsPluginConstants.IMEI));
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.IMSI)); mobileDevice.setImsi(rs.getString(WindowsPluginConstants.IMSI));
mobileDevice.setModel(rs.getString(WindowsPluginConstants.DEVICE_MODEL)); mobileDevice.setModel(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
@ -72,7 +71,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
mobileDevice.setSerial(rs.getString(WindowsPluginConstants.SERIAL)); mobileDevice.setSerial(rs.getString(WindowsPluginConstants.SERIAL));
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE)); mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
Map<String, String> propertyMap = new HashMap<String, String>(); Map<String, String> propertyMap = new HashMap<>();
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI)); propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO)); propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
propertyMap.put(WindowsPluginConstants.MAC_ADDRESS, rs.getString(WindowsPluginConstants.MAC_ADDRESS)); propertyMap.put(WindowsPluginConstants.MAC_ADDRESS, rs.getString(WindowsPluginConstants.MAC_ADDRESS));
@ -99,7 +98,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
try { try {
conn = WindowsDAOFactory.getConnection(); conn = WindowsDAOFactory.getConnection();
String createDBQuery = 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, " + "IMSI, OS_VERSION, DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, " +
"MAC_ADDRESS, DEVICE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; "MAC_ADDRESS, DEVICE_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
@ -139,14 +138,14 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
@Override @Override
public boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException { public boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException {
boolean status = false; boolean status = false;
Connection conn = null; Connection conn;
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
conn = WindowsDAOFactory.getConnection(); conn = WindowsDAOFactory.getConnection();
String updateDBQuery = 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 = ?, " + "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); stmt = conn.prepareStatement(updateDBQuery);
@ -188,7 +187,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
PreparedStatement stmt = null; PreparedStatement stmt = null;
try { try {
conn = WindowsDAOFactory.getConnection(); 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 = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblDeviceId); stmt.setString(1, mblDeviceId);
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
@ -214,20 +213,20 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
PreparedStatement stmt = null; PreparedStatement stmt = null;
ResultSet rs = null; ResultSet rs = null;
MobileDevice mobileDevice; MobileDevice mobileDevice;
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>(); List<MobileDevice> mobileDevices = new ArrayList<>();
try { try {
conn = WindowsDAOFactory.getConnection(); conn = WindowsDAOFactory.getConnection();
String selectDBQuery = 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_MODEL, VENDOR, LATITUDE, LONGITUDE, SERIAL, MAC_ADDRESS," +
" OS_VERSION, DEVICE_NAME " + " OS_VERSION, DEVICE_NAME " +
"FROM WINDOWS_DEVICE"; "FROM WIN_DEVICE";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
rs = stmt.executeQuery(); rs = stmt.executeQuery();
while (rs.next()) { while (rs.next()) {
mobileDevice = new MobileDevice(); 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.setVendor(rs.getString(WindowsPluginConstants.IMEI));
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI)); mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI));
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION)); mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION));
@ -235,7 +234,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR)); mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR));
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE)); mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
Map<String, String> propertyMap = new HashMap<String, String>(); Map<String, String> propertyMap = new HashMap<>();
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI)); propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO)); propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
propertyMap.put(WindowsPluginConstants.DEVICE_NAME, rs.getString(WindowsPluginConstants.DEVICE_NAME)); propertyMap.put(WindowsPluginConstants.DEVICE_NAME, rs.getString(WindowsPluginConstants.DEVICE_NAME));

@ -24,7 +24,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows.util;
public class WindowsPluginConstants { public class WindowsPluginConstants {
//properties related to database table WINDOWS_DEVICE //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 CHANNEL_URI = "CHANNEL_URI";
public static final String DEVICE_INFO = "DEVICE_INFO"; public static final String DEVICE_INFO = "DEVICE_INFO";
public static final String IMEI = "IMEI"; public static final String IMEI = "IMEI";

@ -3,7 +3,7 @@
-- Table `AD_DEVICE` -- Table `AD_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `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 , `PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL ,
`IMEI` VARCHAR(45) NULL DEFAULT NULL , `IMEI` VARCHAR(45) NULL DEFAULT NULL ,
`IMSI` 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, `TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL, `UNLOCK_TOKEN` VARCHAR(500) NULL DEFAULT NULL,
`SERIAL` VARCHAR(45) 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`) , PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_DEVICE` CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_DEVICE`
FOREIGN KEY (`DEVICE_ID` ) FOREIGN KEY (`DEVICE_ID` )
REFERENCES `AD_DEVICE` (`MOBILE_DEVICE_ID` ) REFERENCES `AD_DEVICE` (`DEVICE_ID` )
ON DELETE NO ACTION ON DELETE NO ACTION
ON UPDATE NO ACTION, ON UPDATE NO ACTION,
CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_OPERATION1` CONSTRAINT `fk_AD_DEVICE_OPERATION_AD_OPERATION1`

@ -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`));

@ -1,5 +1,5 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `MBL_DEVICE` -- Table `AD_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , `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` ( CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT, `ID` INT NOT NULL AUTO_INCREMENT,

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

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

@ -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');

@ -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');

@ -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');

@ -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`)
);

@ -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` -- Table `IOS_DEVICE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `IOS_DEVICE` (
CREATE TABLE IF NOT EXISTS `IOS_DEVICE` ( `DEVICE_ID` VARCHAR(45) NOT NULL,
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL,
`APNS_PUSH_TOKEN` VARCHAR(100) NULL DEFAULT NULL, `APNS_PUSH_TOKEN` VARCHAR(100) NULL DEFAULT NULL,
`MAGIC_TOKEN` VARCHAR(100) NULL DEFAULT NULL, `MAGIC_TOKEN` VARCHAR(100) NULL DEFAULT NULL,
`MDM_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, `ICCID` VARCHAR(45) NULL DEFAULT NULL,
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL, `LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
PRIMARY KEY (`MOBILE_DEVICE_ID`) ) PRIMARY KEY (`DEVICE_ID`)
ENGINE = InnoDB; ) 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;

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

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

@ -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');

@ -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`)
);

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

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

@ -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
);
Loading…
Cancel
Save