basic db scripts for h2 and mysql

merge-requests/7/head
inosh-perera 10 years ago
parent 2a1f6d38fe
commit c05bfdbe29

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

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

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

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