From 08583243e8ad772679657bf06ded1537584896ef Mon Sep 17 00:00:00 2001 From: inosh-perera Date: Mon, 12 Jan 2015 16:42:36 +0530 Subject: [PATCH] plugin database script added --- .../repository/dbscripts/cdm/plugins/h2.sql | 99 ++++++++++++++++--- .../repository/dbscripts/cdm/plugins/h2.sql~ | 88 +++++++++++++++++ .../dbscripts/cdm/plugins/mysql.sql | 88 +++++++++++++++++ .../dbscripts/cdm/plugins/mysql.sql~ | 15 +++ 4 files changed, 279 insertions(+), 11 deletions(-) create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql~ diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql index ed495ac1907..85304414bf4 100644 --- a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql @@ -1,11 +1,88 @@ -CREATE TABLE IF NOT EXISTS MBL_DEVICE -( - MOBILE_DEVICE_ID VARCHAR(45) NOT NULL, - REG_ID VARCHAR(45) NOT NULL, - IMEI VARCHAR(45) NOT NULL, - IMSI VARCHAR(45), - OS_VERSION VARCHAR(45) NOT NULL, - DEVICE_MODEL VARCHAR(45) NOT NULL, - VENDOR VARCHAR(45) NOT NULL, - PRIMARY KEY (MOBILE_DEVICE_ID) -); \ No newline at end of file + +-- ----------------------------------------------------- +-- Table `MBL_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( + `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL , + `REG_ID` 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 , + PRIMARY KEY (`MOBILE_DEVICE_ID`) ); + + +-- ----------------------------------------------------- +-- Table `MBL_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT , + `CODE` VARCHAR(45) NULL , + `NAME` VARCHAR(100) NULL , + `DESCRIPTION` VARCHAR(200) NULL , + 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) NULL , + `CREATED_DATE` INT NULL , + PRIMARY KEY (`OPERATION_ID`) , + CONSTRAINT `fk_MBL_OPERATION_MBL_FEATURES1` + FOREIGN KEY (`FEATURE_CODE` ) + REFERENCES `MBL_FEATURE` (`CODE` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION); + +-- ----------------------------------------------------- +-- Table `MBL_DEVICE_OPERATION_MAPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPING` ( + `DEVICE_ID` VARCHAR(45) NOT NULL , + `OPERATION_ID` INT NOT NULL , + `SENT_DATE` INT NULL , + `RECEIVED_DATE` INT 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_PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `OPERATION_ID` INT NULL , + `PROPERTY_ID` INT NULL , + `VALUE` TEXT NULL , + PRIMARY KEY (`OPERATION_PROPERTY_ID`) , + 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` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` ( + `PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `PROPERTY` VARCHAR(100) NULL , + `FEATURE_ID` VARCHAR(45) NULL , + PRIMARY KEY (`PROPERTY_ID`) , + CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1` + FOREIGN KEY (`FEATURE_ID` ) + REFERENCES `MBL_FEATURE` (`FEATURE_ID` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION); + diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ new file mode 100644 index 00000000000..85304414bf4 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ @@ -0,0 +1,88 @@ + +-- ----------------------------------------------------- +-- Table `MBL_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( + `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL , + `REG_ID` 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 , + PRIMARY KEY (`MOBILE_DEVICE_ID`) ); + + +-- ----------------------------------------------------- +-- Table `MBL_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT , + `CODE` VARCHAR(45) NULL , + `NAME` VARCHAR(100) NULL , + `DESCRIPTION` VARCHAR(200) NULL , + 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) NULL , + `CREATED_DATE` INT NULL , + PRIMARY KEY (`OPERATION_ID`) , + CONSTRAINT `fk_MBL_OPERATION_MBL_FEATURES1` + FOREIGN KEY (`FEATURE_CODE` ) + REFERENCES `MBL_FEATURE` (`CODE` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION); + +-- ----------------------------------------------------- +-- Table `MBL_DEVICE_OPERATION_MAPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPING` ( + `DEVICE_ID` VARCHAR(45) NOT NULL , + `OPERATION_ID` INT NOT NULL , + `SENT_DATE` INT NULL , + `RECEIVED_DATE` INT 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_PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `OPERATION_ID` INT NULL , + `PROPERTY_ID` INT NULL , + `VALUE` TEXT NULL , + PRIMARY KEY (`OPERATION_PROPERTY_ID`) , + 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` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` ( + `PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `PROPERTY` VARCHAR(100) NULL , + `FEATURE_ID` VARCHAR(45) NULL , + PRIMARY KEY (`PROPERTY_ID`) , + CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1` + FOREIGN KEY (`FEATURE_ID` ) + REFERENCES `MBL_FEATURE` (`FEATURE_ID` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION); + diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql index afc4f32d9e2..b4943b70508 100644 --- a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql @@ -13,3 +13,91 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( ENGINE = InnoDB; +-- ----------------------------------------------------- +-- Table `MBL_FEATURE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( + `FEATURE_ID` INT NOT NULL AUTO_INCREMENT , + `CODE` VARCHAR(45) NULL , + `NAME` VARCHAR(100) NULL , + `DESCRIPTION` VARCHAR(200) NULL , + PRIMARY KEY (`FEATURE_ID`) ) +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`) , + INDEX `fk_MBL_OPERATION_MBL_FEATURES1_idx` (`FEATURE_CODE` ASC) , + CONSTRAINT `fk_MBL_OPERATION_MBL_FEATURES1` + FOREIGN KEY (`FEATURE_CODE` ) + REFERENCES `MBL_FEATURE` (`CODE` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `MBL_DEVICE_OPERATION_MAPING` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPING` ( + `DEVICE_ID` VARCHAR(45) NOT NULL , + `OPERATION_ID` INT NOT NULL , + `SENT_DATE` INT NULL , + `RECEIVED_DATE` INT 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_PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `OPERATION_ID` INT NULL , + `PROPERTY_ID` INT NULL , + `VALUE` TEXT NULL , + PRIMARY KEY (`OPERATION_PROPERTY_ID`) , + INDEX `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1_idx` (`OPERATION_ID` ASC) , + 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` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` ( + `PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , + `PROPERTY` VARCHAR(100) NULL , + `FEATURE_ID` VARCHAR(45) NULL , + PRIMARY KEY (`PROPERTY_ID`) , + INDEX `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1_idx` (`FEATURE_ID` ASC) , + 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; + + + diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql~ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql~ new file mode 100644 index 00000000000..afc4f32d9e2 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/mysql.sql~ @@ -0,0 +1,15 @@ +-- ----------------------------------------------------- +-- Table `MBL_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( + `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, + `REG_ID` VARCHAR(45) NULL, + `IMEI` VARCHAR(45) NULL, + `IMSI` VARCHAR(45) NULL, + `OS_VERSION` VARCHAR(45) NULL, + `DEVICE_MODEL` VARCHAR(45) NULL, + `VENDOR` VARCHAR(45) NULL, + PRIMARY KEY (`MOBILE_DEVICE_ID`)) +ENGINE = InnoDB; + +