|
|
@ -1,8 +1,19 @@
|
|
|
|
|
|
|
|
-- MySQL Workbench Forward Engineering
|
|
|
|
|
|
|
|
|
|
|
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
|
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
|
|
|
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
|
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
|
|
|
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL';
|
|
|
|
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
-- Schema mydb
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
-- Schema WSO2CDM
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
DROP SCHEMA IF EXISTS `WSO2CDM` ;
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
-- Schema WSO2CDM
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
CREATE SCHEMA IF NOT EXISTS `WSO2CDM` DEFAULT CHARACTER SET latin1 ;
|
|
|
|
CREATE SCHEMA IF NOT EXISTS `WSO2CDM` DEFAULT CHARACTER SET latin1 ;
|
|
|
|
USE `WSO2CDM` ;
|
|
|
|
USE `WSO2CDM` ;
|
|
|
|
|
|
|
|
|
|
|
@ -11,36 +22,31 @@ USE `WSO2CDM` ;
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_TYPE` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_TYPE` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_TYPE` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_TYPE` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`NAME` VARCHAR(300) NULL DEFAULT NULL ,
|
|
|
|
`NAME` VARCHAR(300) NULL DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`ID`) )
|
|
|
|
PRIMARY KEY (`ID`))
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE`
|
|
|
|
-- Table `WSO2CDM`.`DM_PROFILE`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_PROFILE` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_PROFILE` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`DESCRIPTION` TEXT NULL DEFAULT NULL ,
|
|
|
|
`PROFILE_NAME` VARCHAR(45) NOT NULL,
|
|
|
|
`NAME` VARCHAR(100) NULL DEFAULT NULL ,
|
|
|
|
`TENANT_ID` INT(11) NOT NULL,
|
|
|
|
`DATE_OF_ENROLLMENT` BIGINT(20) NULL DEFAULT NULL ,
|
|
|
|
`DEVICE_TYPE_ID` INT(11) NOT NULL,
|
|
|
|
`DATE_OF_LAST_UPDATE` BIGINT(20) NULL DEFAULT NULL ,
|
|
|
|
`CREATED_TIME` DATETIME NOT NULL,
|
|
|
|
`OWNERSHIP` VARCHAR(45) NULL DEFAULT NULL ,
|
|
|
|
`UPDATED_TIME` DATETIME NOT NULL,
|
|
|
|
`STATUS` VARCHAR(15) NULL DEFAULT NULL ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
`DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL ,
|
|
|
|
INDEX `DM_PROFILE_DEVICE_TYPE` (`DEVICE_TYPE_ID` ASC),
|
|
|
|
`DEVICE_IDENTIFICATION` VARCHAR(300) NULL DEFAULT NULL ,
|
|
|
|
CONSTRAINT `DM_PROFILE_DEVICE_TYPE`
|
|
|
|
`OWNER` VARCHAR(45) NULL DEFAULT NULL ,
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID`)
|
|
|
|
`TENANT_ID` INT(11) NULL DEFAULT '0' ,
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID`)
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
|
|
|
|
INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2` (`DEVICE_TYPE_ID` ASC) ,
|
|
|
|
|
|
|
|
CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2`
|
|
|
|
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
@ -48,43 +54,41 @@ DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_PROFILE`
|
|
|
|
-- Table `WSO2CDM`.`DM_POLICY`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_PROFILE` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_POLICY` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_PROFILE` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_POLICY` (
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`PROFILE_NAME` VARCHAR(45) NOT NULL ,
|
|
|
|
`NAME` VARCHAR(45) NULL DEFAULT NULL,
|
|
|
|
`TENANT_ID` INT NOT NULL ,
|
|
|
|
`TENANT_ID` INT(11) NOT NULL,
|
|
|
|
`DEVICE_TYPE_ID` INT NOT NULL ,
|
|
|
|
`PROFILE_ID` INT(11) NOT NULL,
|
|
|
|
`CREATED_TIME` DATETIME NOT NULL ,
|
|
|
|
`COMPLIANCE` VARCHAR(100) NULL,
|
|
|
|
`UPDATED_TIME` DATETIME NOT NULL ,
|
|
|
|
`PRIORITY` INT(11) NOT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
INDEX `DM_PROFILE_DEVICE_TYPE` (`DEVICE_TYPE_ID` ASC) ,
|
|
|
|
INDEX `FK_DM_PROFILE_DM_POLICY` (`PROFILE_ID` ASC),
|
|
|
|
CONSTRAINT `DM_PROFILE_DEVICE_TYPE`
|
|
|
|
CONSTRAINT `FK_DM_PROFILE_DM_POLICY`
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID` )
|
|
|
|
FOREIGN KEY (`PROFILE_ID`)
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID` )
|
|
|
|
REFERENCES `WSO2CDM`.`DM_PROFILE` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
ENGINE = InnoDB
|
|
|
|
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_POLICY`
|
|
|
|
-- Table `WSO2CDM`.`DM_DATE`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_POLICY` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DATE` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_POLICY` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DATE` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`START_DATE` DATE NOT NULL,
|
|
|
|
`NAME` VARCHAR(45) NULL DEFAULT NULL ,
|
|
|
|
`END_DATE` DATE NOT NULL,
|
|
|
|
`TENANT_ID` INT(11) NOT NULL ,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL,
|
|
|
|
`PROFILE_ID` INT(11) NOT NULL ,
|
|
|
|
INDEX `DM_DATE_POLICY` (`POLICY_ID` ASC),
|
|
|
|
`PRIORITY` INT NOT NULL ,
|
|
|
|
CONSTRAINT `DM_DATE_POLICY`
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
INDEX `FK_DM_PROFILE_DM_POLICY` (`PROFILE_ID` ASC) ,
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
CONSTRAINT `FK_DM_PROFILE_DM_POLICY`
|
|
|
|
|
|
|
|
FOREIGN KEY (`PROFILE_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_PROFILE` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
@ -92,25 +96,27 @@ DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE_POLICY`
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_POLICY` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_POLICY` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`DEVICE_ID` INT(11) NOT NULL ,
|
|
|
|
`DESCRIPTION` TEXT NULL DEFAULT NULL,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL ,
|
|
|
|
`NAME` VARCHAR(100) NULL DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
`DATE_OF_ENROLLMENT` BIGINT(20) NULL DEFAULT NULL,
|
|
|
|
INDEX `FK_POLICY_DEVICE_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
`DATE_OF_LAST_UPDATE` BIGINT(20) NULL DEFAULT NULL,
|
|
|
|
INDEX `FK_DEVICE_DEVICE_POLICY` (`DEVICE_ID` ASC) ,
|
|
|
|
`OWNERSHIP` VARCHAR(45) NULL DEFAULT NULL,
|
|
|
|
CONSTRAINT `FK_POLICY_DEVICE_POLICY`
|
|
|
|
`STATUS` VARCHAR(15) NULL DEFAULT NULL,
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
`DEVICE_TYPE_ID` INT(11) NULL DEFAULT NULL,
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
`DEVICE_IDENTIFICATION` VARCHAR(300) NULL DEFAULT NULL,
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
`OWNER` VARCHAR(45) NULL DEFAULT NULL,
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
`TENANT_ID` INT(11) NULL DEFAULT '0',
|
|
|
|
CONSTRAINT `FK_DEVICE_DEVICE_POLICY`
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
FOREIGN KEY (`DEVICE_ID` )
|
|
|
|
INDEX `fk_DM_DEVICE_DM_DEVICE_TYPE2` (`DEVICE_TYPE_ID` ASC),
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE` (`ID` )
|
|
|
|
CONSTRAINT `fk_DM_DEVICE_DM_DEVICE_TYPE2`
|
|
|
|
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
@ -118,25 +124,25 @@ DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE_TYPE_POLICY`
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE_POLICY`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_TYPE_POLICY` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_POLICY` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_TYPE_POLICY` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_POLICY` (
|
|
|
|
`ID` INT(11) NOT NULL ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`DEVICE_TYPE_ID` INT(11) NOT NULL ,
|
|
|
|
`DEVICE_ID` INT(11) NOT NULL,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL ,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
INDEX `FK_DEVICE_TYPE_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
INDEX `FK_POLICY_DEVICE_POLICY` (`POLICY_ID` ASC),
|
|
|
|
INDEX `FK_DEVICE_TYPE_POLICY_DEVICE_TYPE` (`DEVICE_TYPE_ID` ASC) ,
|
|
|
|
INDEX `FK_DEVICE_DEVICE_POLICY` (`DEVICE_ID` ASC),
|
|
|
|
CONSTRAINT `FK_DEVICE_TYPE_POLICY`
|
|
|
|
CONSTRAINT `FK_DEVICE_DEVICE_POLICY`
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
FOREIGN KEY (`DEVICE_ID`)
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
CONSTRAINT `FK_DEVICE_TYPE_POLICY_DEVICE_TYPE`
|
|
|
|
CONSTRAINT `FK_POLICY_DEVICE_POLICY`
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID` )
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID` )
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
@ -144,49 +150,53 @@ DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_FEATURES`
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_FEATURES` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_FEATURES` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`NAME` VARCHAR(256) NOT NULL ,
|
|
|
|
`DEVICE_ID` INT(11) NOT NULL,
|
|
|
|
`CODE` VARCHAR(45) NULL DEFAULT NULL ,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL,
|
|
|
|
`DEVICE_TYPE_ID` INT NOT NULL ,
|
|
|
|
`POLICY_CONTENT` BLOB NULL DEFAULT NULL,
|
|
|
|
`DESCRIPTION` TEXT NULL DEFAULT NULL ,
|
|
|
|
`APPLIED` TINYINT(1) NULL DEFAULT NULL,
|
|
|
|
`EVALUATION_RULE` VARCHAR(60) NOT NULL ,
|
|
|
|
`CREATED_TIME` TIMESTAMP NULL DEFAULT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
`UPDATED_TIME` TIMESTAMP NULL DEFAULT NULL,
|
|
|
|
INDEX `DM_FEATURES_DEVICE_TYPE` (`DEVICE_TYPE_ID` ASC) ,
|
|
|
|
`APPLIED_TIME` TIMESTAMP NULL DEFAULT NULL,
|
|
|
|
CONSTRAINT `DM_FEATURES_DEVICE_TYPE`
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
FOREIGN KEY (`DEVICE_TYPE_ID` )
|
|
|
|
INDEX `FK_DM_POLICY_DEVCIE_APPLIED` (`DEVICE_ID` ASC),
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE_TYPE` (`ID` )
|
|
|
|
INDEX `FK_DM_POLICY_DEVICE_APPLIED_POLICY` (`POLICY_ID` ASC),
|
|
|
|
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DEVCIE_APPLIED`
|
|
|
|
|
|
|
|
FOREIGN KEY (`DEVICE_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE` (`ID`)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DEVICE_APPLIED_POLICY`
|
|
|
|
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_PROFILE_FEATURES`
|
|
|
|
-- Table `WSO2CDM`.`DM_PROFILE_FEATURES`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_PROFILE_FEATURES` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_PROFILE_FEATURES` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_PROFILE_FEATURES` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_PROFILE_FEATURES` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`PROFILE_ID` INT(11) NOT NULL ,
|
|
|
|
`PROFILE_ID` INT(11) NOT NULL,
|
|
|
|
`FEATURE_ID` INT(11) NOT NULL ,
|
|
|
|
`FEATURE_CODE` VARCHAR(10) NOT NULL,
|
|
|
|
`CONTENT` BLOB NULL DEFAULT NULL ,
|
|
|
|
`DEVICE_TYPE_ID` INT NOT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
`CONTENT` BLOB NULL DEFAULT NULL,
|
|
|
|
INDEX `fk_DM_POLICY_FEATURES_DM_FEATURES1` (`FEATURE_ID` ASC) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
INDEX `FK_DM_PROFILE_DM_POLICY_FEATURES` (`PROFILE_ID` ASC) ,
|
|
|
|
INDEX `FK_DM_PROFILE_DM_POLICY_FEATURES` (`PROFILE_ID` ASC),
|
|
|
|
CONSTRAINT `fk_DM_POLICY_FEATURES_DM_FEATURES1`
|
|
|
|
|
|
|
|
FOREIGN KEY (`FEATURE_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_FEATURES` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT `FK_DM_PROFILE_DM_POLICY_FEATURES`
|
|
|
|
CONSTRAINT `FK_DM_PROFILE_DM_POLICY_FEATURES`
|
|
|
|
FOREIGN KEY (`PROFILE_ID` )
|
|
|
|
FOREIGN KEY (`PROFILE_ID`)
|
|
|
|
REFERENCES `WSO2CDM`.`DM_PROFILE` (`ID` )
|
|
|
|
REFERENCES `WSO2CDM`.`DM_PROFILE` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
@ -198,125 +208,101 @@ DEFAULT CHARACTER SET = latin1;
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_ROLE_POLICY` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_ROLE_POLICY` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_ROLE_POLICY` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_ROLE_POLICY` (
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`ROLE_NAME` VARCHAR(45) NOT NULL ,
|
|
|
|
`ROLE_NAME` VARCHAR(45) NOT NULL,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL ,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
INDEX `FK_ROLE_POLICY_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
INDEX `FK_ROLE_POLICY_POLICY` (`POLICY_ID` ASC),
|
|
|
|
CONSTRAINT `FK_ROLE_POLICY_POLICY`
|
|
|
|
CONSTRAINT `FK_ROLE_POLICY_POLICY`
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB
|
|
|
|
ENGINE = InnoDB
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
-- Table `WSO2CDM`.`DM_LOCATION`
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_LOCATION` ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_LOCATION` (
|
|
|
|
|
|
|
|
`LATITUDE` VARCHAR(45) NOT NULL ,
|
|
|
|
|
|
|
|
`LONGITUDE` VARCHAR(45) NOT NULL ,
|
|
|
|
|
|
|
|
`POLICY_ID` INT(11) NOT NULL ,
|
|
|
|
|
|
|
|
INDEX `FK_DM_POLICY_DM_LOCATION` (`POLICY_ID` ASC) ,
|
|
|
|
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DM_LOCATION`
|
|
|
|
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_TIME`
|
|
|
|
-- Table `WSO2CDM`.`DM_USER_POLICY`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_TIME` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_USER_POLICY` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_TIME` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_USER_POLICY` (
|
|
|
|
`STARTING_TIME` DATETIME NOT NULL ,
|
|
|
|
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
|
|
|
`ENDING_TIME` DATETIME NOT NULL ,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL,
|
|
|
|
`POLICY_ID` INT(11) NOT NULL ,
|
|
|
|
`USERNAME` VARCHAR(45) NOT NULL,
|
|
|
|
INDEX `FK_DM_POLICY_DM_TIME` (`POLICY_ID` ASC) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DM_TIME`
|
|
|
|
INDEX `DM_POLICY_USER_POLICY` (`POLICY_ID` ASC),
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
CONSTRAINT `DM_POLICY_USER_POLICY`
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
ENGINE = InnoDB
|
|
|
|
|
|
|
|
DEFAULT CHARACTER SET = latin1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_DATE`
|
|
|
|
-- Table `WSO2CDM`.`DM_CRITERIA`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DATE` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_CRITERIA` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DATE` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_CRITERIA` (
|
|
|
|
`START_DATE` DATE NOT NULL ,
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT,
|
|
|
|
`END_DATE` DATE NOT NULL ,
|
|
|
|
`TENANT_ID` INT NOT NULL,
|
|
|
|
`POLICY_ID` INT NOT NULL ,
|
|
|
|
`NAME` VARCHAR(50) NULL,
|
|
|
|
INDEX `DM_DATE_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
PRIMARY KEY (`ID`))
|
|
|
|
CONSTRAINT `DM_DATE_POLICY`
|
|
|
|
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_USER_POLICY`
|
|
|
|
-- Table `WSO2CDM`.`DM_POLICY_CRITERIA`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_USER_POLICY` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_POLICY_CRITERIA` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_USER_POLICY` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_POLICY_CRITERIA` (
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT,
|
|
|
|
`POLICY_ID` INT NOT NULL ,
|
|
|
|
`CRITERIA_ID` INT NOT NULL,
|
|
|
|
`USERNAME` VARCHAR(45) NOT NULL ,
|
|
|
|
`POLICY_ID` INT NOT NULL,
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
INDEX `DM_POLICY_USER_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
INDEX `FK_CRITERIA_POLICY_CRITERIA_idx` (`CRITERIA_ID` ASC),
|
|
|
|
CONSTRAINT `DM_POLICY_USER_POLICY`
|
|
|
|
INDEX `FK_POLICY_POLICY_CRITERIA_idx` (`POLICY_ID` ASC),
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
CONSTRAINT `FK_CRITERIA_POLICY_CRITERIA`
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
FOREIGN KEY (`CRITERIA_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_CRITERIA` (`ID`)
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT `FK_POLICY_POLICY_CRITERIA`
|
|
|
|
|
|
|
|
FOREIGN KEY (`POLICY_ID`)
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID`)
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- Table `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED`
|
|
|
|
-- Table `WSO2CDM`.`DM_POLICY_CRITERIA_PROPERTIES`
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
-- -----------------------------------------------------
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED` ;
|
|
|
|
DROP TABLE IF EXISTS `WSO2CDM`.`DM_POLICY_CRITERIA_PROPERTIES` ;
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_DEVICE_POLICY_APPLIED` (
|
|
|
|
CREATE TABLE IF NOT EXISTS `WSO2CDM`.`DM_POLICY_CRITERIA_PROPERTIES` (
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT ,
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT,
|
|
|
|
`DEVICE_ID` INT NOT NULL ,
|
|
|
|
`POLICY_CRITERION_ID` INT NOT NULL,
|
|
|
|
`POLICY_ID` INT NOT NULL ,
|
|
|
|
`PROP_KEY` VARCHAR(45) NULL,
|
|
|
|
`POLICY_CONTENT` BLOB NULL ,
|
|
|
|
`PROP_VALUE` VARCHAR(100) NULL,
|
|
|
|
`APPLIED` TINYINT(1) NULL ,
|
|
|
|
`CONTENT` BLOB NULL COMMENT 'This is used to ',
|
|
|
|
`CREATED_TIME` TIMESTAMP NULL ,
|
|
|
|
PRIMARY KEY (`ID`),
|
|
|
|
`UPDATED_TIME` TIMESTAMP NULL ,
|
|
|
|
INDEX `FK_POLICY_CRITERIA_PROPERTIES_idx` (`POLICY_CRITERION_ID` ASC),
|
|
|
|
`APPLIED_TIME` TIMESTAMP NULL ,
|
|
|
|
CONSTRAINT `FK_POLICY_CRITERIA_PROPERTIES`
|
|
|
|
PRIMARY KEY (`ID`) ,
|
|
|
|
FOREIGN KEY (`POLICY_CRITERION_ID`)
|
|
|
|
INDEX `FK_DM_POLICY_DEVCIE_APPLIED` (`DEVICE_ID` ASC) ,
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY_CRITERIA` (`ID`)
|
|
|
|
INDEX `FK_DM_POLICY_DEVICE_APPLIED_POLICY` (`POLICY_ID` ASC) ,
|
|
|
|
ON DELETE CASCADE
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DEVCIE_APPLIED`
|
|
|
|
|
|
|
|
FOREIGN KEY (`DEVICE_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_DEVICE` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION,
|
|
|
|
|
|
|
|
CONSTRAINT `FK_DM_POLICY_DEVICE_APPLIED_POLICY`
|
|
|
|
|
|
|
|
FOREIGN KEY (`POLICY_ID` )
|
|
|
|
|
|
|
|
REFERENCES `WSO2CDM`.`DM_POLICY` (`ID` )
|
|
|
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ON UPDATE NO ACTION)
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
ENGINE = InnoDB;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
|
SET SQL_MODE=@OLD_SQL_MODE;
|
|
|
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
|
|
|
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
|
|
|
|
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
|
|
|
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
|
|
|
|