From c05bfdbe29f7a333e936968a5c3ba505f20b1eee Mon Sep 17 00:00:00 2001 From: inosh-perera Date: Wed, 3 Dec 2014 15:25:36 +0530 Subject: [PATCH] basic db scripts for h2 and mysql --- .../src/repository/dbscripts/cdm/h2.sql | 23 ++++++++++++ .../src/repository/dbscripts/cdm/h2.sql~ | 23 ++++++++++++ .../src/repository/dbscripts/cdm/mysql.sql | 34 ++++++++++++++++++ .../src/repository/dbscripts/cdm/mysql.sql~ | 36 +++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/h2.sql create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/h2.sql~ create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql create mode 100644 product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql~ diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql new file mode 100644 index 00000000000..4c1e805f9b2 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql @@ -0,0 +1,23 @@ +CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE +( + ID INT(11) NOT NULL, + NAME VARCHAR(300) NULL DEFAULT NULL, + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS DM_DEVICE +( + ID VARCHAR(20) NOT NULL, + DESCRIPTION TEXT NULL DEFAULT NULL, + NAME VARCHAR(100) NULL DEFAULT NULL, + DATE_OF_ENROLLMENT DATETIME NULL DEFAULT NULL, + DATE_OF_LAST_UPDATE DATETIME NULL DEFAULT NULL, + OWNERSHIP VARCHAR(45) NULL DEFAULT NULL, + STATUS VARCHAR(15) NULL DEFAULT NULL, + DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL, + DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL, + OWNER VARCHAR(45) NULL DEFAULT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID ) + REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION +); diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql~ b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql~ new file mode 100644 index 00000000000..4c1e805f9b2 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql~ @@ -0,0 +1,23 @@ +CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE +( + ID INT(11) NOT NULL, + NAME VARCHAR(300) NULL DEFAULT NULL, + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS DM_DEVICE +( + ID VARCHAR(20) NOT NULL, + DESCRIPTION TEXT NULL DEFAULT NULL, + NAME VARCHAR(100) NULL DEFAULT NULL, + DATE_OF_ENROLLMENT DATETIME NULL DEFAULT NULL, + DATE_OF_LAST_UPDATE DATETIME NULL DEFAULT NULL, + OWNERSHIP VARCHAR(45) NULL DEFAULT NULL, + STATUS VARCHAR(15) NULL DEFAULT NULL, + DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL, + DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL, + OWNER VARCHAR(45) NULL DEFAULT NULL, + PRIMARY KEY (ID), + CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID ) + REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION +); diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql b/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql new file mode 100644 index 00000000000..fc78109c545 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql @@ -0,0 +1,34 @@ +-- ----------------------------------------------------- +-- Table `DM_DEVICE_TYPE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `DM_DEVICE_TYPE` ( + `ID` INT(11) NOT NULL , + `NAME` VARCHAR(300) NULL DEFAULT NULL , + PRIMARY KEY (`ID`) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `DM_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `DM_DEVICE` ( + `ID` VARCHAR(20) NOT NULL , + `DESCRIPTION` TEXT NULL DEFAULT NULL , + `NAME` VARCHAR(100) NULL DEFAULT NULL , + `DATE_OF_ENROLLMENT` DATETIME NULL DEFAULT NULL , + `DATE_OF_LAST_UPDATE` DATETIME NULL DEFAULT NULL , + `OWNERSHIP` VARCHAR(45) NULL DEFAULT NULL , + `STATUS` VARCHAR(15) NULL DEFAULT NULL , + `DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL , + `DEVICE_IDENTIFICATION` VARCHAR(300) NULL DEFAULT NULL , + `OWNER` VARCHAR(45) NULL DEFAULT NULL , + PRIMARY KEY (`ID`) , + INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2_idx` (`DEVICE_TYPE_ID` ASC) , + CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2` + FOREIGN KEY (`DEVICE_TYPE_ID` ) + REFERENCES `DM_DEVICE_TYPE` (`ID` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql~ b/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql~ new file mode 100644 index 00000000000..fdb62f912f3 --- /dev/null +++ b/product/modules/distribution/src/repository/dbscripts/cdm/mysql.sql~ @@ -0,0 +1,36 @@ +USE `WSO2CDM_DB`; + +-- ----------------------------------------------------- +-- Table `DM_DEVICE_TYPE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `DM_DEVICE_TYPE` ( + `ID` INT(11) NOT NULL , + `NAME` VARCHAR(300) NULL DEFAULT NULL , + PRIMARY KEY (`ID`) ) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1; + + +-- ----------------------------------------------------- +-- Table `DM_DEVICE` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `DM_DEVICE` ( + `ID` VARCHAR(20) NOT NULL , + `DESCRIPTION` TEXT NULL DEFAULT NULL , + `NAME` VARCHAR(100) NULL DEFAULT NULL , + `DATE_OF_ENROLLMENT` DATETIME NULL DEFAULT NULL , + `DATE_OF_LAST_UPDATE` DATETIME NULL DEFAULT NULL , + `OWNERSHIP` VARCHAR(45) NULL DEFAULT NULL , + `STATUS` VARCHAR(15) NULL DEFAULT NULL , + `DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL , + `DEVICE_IDENTIFICATION` VARCHAR(300) NULL DEFAULT NULL , + `OWNER` VARCHAR(45) NULL DEFAULT NULL , + PRIMARY KEY (`ID`) , + INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2_idx` (`DEVICE_TYPE_ID` ASC) , + CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2` + FOREIGN KEY (`DEVICE_TYPE_ID` ) + REFERENCES `DM_DEVICE_TYPE` (`ID` ) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB +DEFAULT CHARACTER SET = latin1;