Added android sql scripts

revert-dabc3590
Dileesha Rajapakse 9 years ago
parent c47ace254c
commit 297c7d1e96

@ -0,0 +1,53 @@
-- -----------------------------------------------------
-- Table `AD_DEVICE`
-- -----------------------------------------------------
CREATE TABLE 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 AD_FEATURE (
[ID] INT NOT NULL IDENTITY,
[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,10 +1,10 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- 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,
`DEVICE_INFO` VARCHAR(500) NULL DEFAULT NULL,
`GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL, `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL,
`DEVICE_INFO` VARCHAR(8000) 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,
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
@ -18,9 +18,8 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
PRIMARY KEY (`ANDROID_DEVICE_ID`)) PRIMARY KEY (`ANDROID_DEVICE_ID`))
ENGINE = InnoDB; 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,
@ -30,3 +29,29 @@ CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
PRIMARY KEY (`ID`)) PRIMARY KEY (`ID`))
ENGINE = InnoDB; ENGINE = InnoDB;
-- -----------------------------------------------------
-- 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');

@ -35,4 +35,37 @@ CREATE TABLE IF NOT EXISTS `IOS_FEATURE` (
ENGINE = InnoDB; ENGINE = InnoDB;
long -- -----------------------------------------------------
-- 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,9 +1,24 @@
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `MBL_DEVICE` -- Table `WINDOWS_FEATURE`
-- ----------------------------------------------------- -- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( 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`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `WINDOWS_DEVICE`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `WINDOWS_DEVICE` (
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL,
`PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL, `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL,
`DEVICE_INFO` VARCHAR(8000) 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,
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
@ -11,42 +26,43 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
`VENDOR` VARCHAR(45) NULL DEFAULT NULL, `VENDOR` 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,
`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, `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`)) PRIMARY KEY (`MOBILE_DEVICE_ID`))
ENGINE = InnoDB; ENGINE = InnoDB;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `MBL_FEATURE` -- TODO remove this later
-- -----------------------------------------------------
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');
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,63 @@
-- -----------------------------------------------------
-- Table `AD_DEVICE`
-- -----------------------------------------------------
CREATE TABLE AD_DEVICE (
ANDROID_DEVICE_ID VARCHAR2(45) NOT NULL,
GCM_TOKEN VARCHAR2(45) DEFAULT NULL NULL,
DEVICE_INFO VARCHAR2(8000) DEFAULT NULL NULL,
IMEI VARCHAR2(45) DEFAULT NULL NULL,
IMSI VARCHAR2(45) DEFAULT NULL NULL,
OS_VERSION VARCHAR2(45) DEFAULT NULL NULL,
DEVICE_MODEL VARCHAR2(45) DEFAULT NULL NULL,
VENDOR VARCHAR2(45) DEFAULT NULL NULL,
LATITUDE VARCHAR2(45) DEFAULT NULL NULL,
LONGITUDE VARCHAR2(45) DEFAULT NULL NULL,
SERIAL VARCHAR2(45) DEFAULT NULL NULL,
MAC_ADDRESS VARCHAR2(45) DEFAULT NULL NULL,
DEVICE_NAME VARCHAR2(100) DEFAULT NULL NULL,
PRIMARY KEY (ANDROID_DEVICE_ID));
-- -----------------------------------------------------
-- Table `AD_FEATURE`
-- -----------------------------------------------------
CREATE TABLE AD_FEATURE (
ID NUMBER(10) NOT NULL,
CODE VARCHAR2(45) NOT NULL,
NAME VARCHAR2(100) NULL,
DESCRIPTION VARCHAR2(200) NULL,
PRIMARY KEY (ID));
-- Generate ID using sequence and trigger
CREATE SEQUENCE AD_FEATURE_seq START WITH 1 INCREMENT BY 1;
CREATE OR REPLACE TRIGGER AD_FEATURE_seq_tr
BEFORE INSERT ON AD_FEATURE FOR EACH ROW
WHEN (NEW.ID IS NULL)
BEGIN
SELECT AD_FEATURE_seq.NEXTVAL INTO :NEW.ID FROM DUAL;
END;
/
-- -----------------------------------------------------
-- TODO remove this later
-- -----------------------------------------------------
INSERT INTO AD_FEATURE (CODE, NAME, DESCRIPTION)
SELECT 'DEVICE_LOCK', 'Device Lock', 'Lock the device' FROM dual UNION ALL
SELECT 'DEVICE_LOCATION', 'Location', 'Request coordinates of device location' FROM dual UNION ALL
SELECT 'WIFI', 'Wifi', 'Setting up wifi configuration' FROM dual UNION ALL
SELECT 'CAMERA', 'Camera', 'Enable or disable camera' FROM dual UNION ALL
SELECT 'EMAIL', 'Email', 'Configure email settings' FROM dual UNION ALL
SELECT 'DEVICE_MUTE', 'Mute', 'Enable mute in the device' FROM dual UNION ALL
SELECT 'DEVICE_INFO', 'Device Info', 'Request device information' FROM dual UNION ALL
SELECT 'ENTERPRISE_WIPE', 'Enterprise Wipe', 'Remove enterprise applications' FROM dual UNION ALL
SELECT 'CLEAR_PASSWORD', 'Clear Password', 'Clear current password' FROM dual UNION ALL
SELECT 'WIPE_DATA', 'Wipe Data', 'Factory reset the device' FROM dual UNION ALL
SELECT 'APPLICATION_LIST', 'Application List', 'Request list of current installed applications' FROM dual UNION ALL
SELECT 'CHANGE_LOCK_CODE', 'Change Lock-code', 'Change current lock code' FROM dual UNION ALL
SELECT 'INSTALL_APPLICATION', 'Install App', 'Install Enterprise or Market application' FROM dual UNION ALL
SELECT 'UNINSTALL_APPLICATION', 'Uninstall App', 'Uninstall application' FROM dual UNION ALL
SELECT 'BLACKLIST_APPLICATIONS', 'Blacklist app', 'Blacklist applications' FROM dual UNION ALL
SELECT 'ENCRYPT_STORAGE', 'Encrypt storage', 'Encrypt storage' FROM dual UNION ALL
SELECT 'DEVICE_RING', 'Ring', 'Ring the device' FROM dual UNION ALL
SELECT 'PASSCODE_POLICY', 'Password Policy', 'Set passcode policy' FROM dual UNION ALL
SELECT 'NOTIFICATION', 'Message', 'Send message' FROM dual;
Loading…
Cancel
Save