Create Plugin Data bases at startup

revert-dabc3590
manoj 10 years ago
parent 5f1d25f044
commit 8dbdde8223

@ -20,6 +20,7 @@ package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.common.MobilePluginConstants;
import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.CarbonUtils;
import org.wso2.carbon.utils.dbcreator.DatabaseCreator; import org.wso2.carbon.utils.dbcreator.DatabaseCreator;
@ -35,8 +36,9 @@ public final class MobileDeviceManagementSchemaInitializer extends DatabaseCreat
private static final Log log = LogFactory.getLog(MobileDeviceManagementSchemaInitializer.class); private static final Log log = LogFactory.getLog(MobileDeviceManagementSchemaInitializer.class);
private static final String setupSQLScriptBaseLocation = private static final String setupSQLScriptBaseLocation =
CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator + "cdm" + CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator
File.separator + "plugins" + File.separator ; + MobilePluginConstants.MOBILE_DB_SCRIPTS_FOLDER +
File.separator + "plugins" + File.separator;
public MobileDeviceManagementSchemaInitializer(DataSource dataSource) { public MobileDeviceManagementSchemaInitializer(DataSource dataSource) {
super(dataSource); super(dataSource);

@ -30,50 +30,6 @@ CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
`DESCRIPTION` VARCHAR(200) NULL , `DESCRIPTION` VARCHAR(200) NULL ,
PRIMARY KEY (`FEATURE_ID`) ); PRIMARY KEY (`FEATURE_ID`) );
-- -----------------------------------------------------
-- Table `MBL_OPERATION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT ,
`FEATURE_CODE` VARCHAR(45) NOT NULL ,
`CREATED_DATE` BIGINT NULL ,
PRIMARY KEY (`OPERATION_ID`));
-- -----------------------------------------------------
-- Table `MBL_DEVICE_OPERATION_MAPPING`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
`DEVICE_ID` VARCHAR(45) NOT NULL ,
`OPERATION_ID` INT NOT NULL ,
`SENT_DATE` BIGINT NULL ,
`RECEIVED_DATE` BIGINT NULL ,
`STATUS` VARCHAR(10) NOT NULL ,
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
FOREIGN KEY (`DEVICE_ID` )
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
FOREIGN KEY (`OPERATION_ID` )
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- -----------------------------------------------------
-- Table `MBL_OPERATION_PROPERTY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
`OPERATION_ID` INT NOT NULL ,
`PROPERTY` VARCHAR(45) NOT NULL ,
`VALUE` TEXT NULL ,
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) ,
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
FOREIGN KEY (`OPERATION_ID` )
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION);
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `MBL_FEATURE_PROPERTY` -- Table `MBL_FEATURE_PROPERTY`
-- ----------------------------------------------------- -- -----------------------------------------------------

@ -31,57 +31,6 @@ CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
PRIMARY KEY (`FEATURE_ID`)) PRIMARY KEY (`FEATURE_ID`))
ENGINE = InnoDB; ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `MBL_OPERATION`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT,
`FEATURE_CODE` VARCHAR(45) NULL,
`CREATED_DATE` INT NULL,
PRIMARY KEY (`OPERATION_ID`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `MBL_DEVICE_OPERATION_MAPING`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
`DEVICE_ID` VARCHAR(45) NOT NULL,
`OPERATION_ID` INT NOT NULL,
`SENT_DATE` INT NULL,
`RECEIVED_DATE` INT NULL,
`STATUS` VARCHAR(10) NOT NULL,
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`),
INDEX `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1_idx` (`OPERATION_ID` ASC),
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
FOREIGN KEY (`DEVICE_ID`)
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
FOREIGN KEY (`OPERATION_ID`)
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `MBL_OPERATION_PROPERTY`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
`OPERATION_ID` INT NULL,
`PROPERTY` VARCHAR(45) NOT NULL ,,
`VALUE` TEXT NULL,
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`),
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
FOREIGN KEY (`OPERATION_ID`)
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- ----------------------------------------------------- -- -----------------------------------------------------
-- Table `MBL_FEATURE_PROPERTY` -- Table `MBL_FEATURE_PROPERTY`
-- ----------------------------------------------------- -- -----------------------------------------------------

Loading…
Cancel
Save