forked from community/device-mgt-core
parent
51b001c236
commit
caf7cd133b
@ -1,58 +1,281 @@
|
||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[APPM_PLATFORM]') AND TYPE IN (N'U'))
|
||||
CREATE TABLE APPM_PLATFORM (
|
||||
ID INT IDENTITY(1,1) NOT NULL UNIQUE,
|
||||
IDENTIFIER VARCHAR (100) NOT NULL,
|
||||
TENANT_ID INT NOT NULL ,
|
||||
NAME VARCHAR (255),
|
||||
FILE_BASED BIT,
|
||||
DESCRIPTION VARCHAR(2048),
|
||||
IS_SHARED BIT,
|
||||
IS_DEFAULT_TENANT_MAPPING BIT,
|
||||
ICON_NAME VARCHAR (100),
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[APPM_PLATFORM_PROPERTIES]') AND TYPE IN (N'U'))
|
||||
CREATE TABLE APPM_PLATFORM_PROPERTIES (
|
||||
ID INT IDENTITY(1,1) NOT NULL,
|
||||
PLATFORM_ID INT NOT NULL,
|
||||
PROP_NAME VARCHAR (100) NOT NULL,
|
||||
OPTIONAL BIT,
|
||||
DEFAUL_VALUE VARCHAR (255),
|
||||
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
|
||||
PRIMARY KEY (ID, PLATFORM_ID, PROP_NAME)
|
||||
);
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[APPM_PLATFORM_TENANT_MAPPING]') AND TYPE IN (N'U'))
|
||||
CREATE TABLE APPM_PLATFORM_TENANT_MAPPING (
|
||||
ID INT IDENTITY(1,1) NOT NULL,
|
||||
TENANT_ID INT NOT NULL ,
|
||||
PLATFORM_ID INT NOT NULL,
|
||||
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
|
||||
PRIMARY KEY (ID, TENANT_ID, PLATFORM_ID)
|
||||
);
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[APPM_PLATFORM_TAG]') AND TYPE IN (N'U'))
|
||||
CREATE TABLE APPM_PLATFORM_TAG (
|
||||
NAME VARCHAR (100) NOT NULL ,
|
||||
PLATFORM_ID INT NOT NULL,
|
||||
FOREIGN KEY(PLATFORM_ID) REFERENCES APPM_PLATFORM(ID) ON DELETE CASCADE,
|
||||
PRIMARY KEY (PLATFORM_ID, NAME)
|
||||
);
|
||||
|
||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[AP_SCHEDULED_SUBSCRIPTION]') AND TYPE IN (N'U'))
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_APP(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
NAME VARCHAR(45) NOT NULL,
|
||||
DESCRIPTION CLOB NULL,
|
||||
TYPE VARCHAR(200) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
|
||||
SUB_TYPE VARCHAR(45) NOT NULL,
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING DOUBLE NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_RELEASE(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
DESCRIPTION VARCHAR(max) NOT NULL,
|
||||
VERSION VARCHAR(70) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
UUID VARCHAR(200) NOT NULL,
|
||||
RELEASE_TYPE VARCHAR(45) NOT NULL,
|
||||
PACKAGE_NAME VARCHAR(45) NOT NULL,
|
||||
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
|
||||
INSTALLER_LOCATION VARCHAR(100) NOT NULL,
|
||||
ICON_LOCATION VARCHAR(100) NOT NULL,
|
||||
BANNER_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
SC_1_LOCATION VARCHAR(100) NOT NULL,
|
||||
SC_2_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
SC_3_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
APP_HASH_VALUE VARCHAR(1000) NOT NULL,
|
||||
SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT FALSE,
|
||||
APP_META_INFO VARCHAR(max) NULL DEFAULT NULL,
|
||||
SUPPORTED_OS_VERSIONS VARCHAR(45) NOT NULL,
|
||||
RATING FLOAT NULL DEFAULT NULL,
|
||||
CURRENT_STATE VARCHAR(45) NOT NULL,
|
||||
RATED_USERS INTEGER NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC);
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_REVIEW
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_REVIEW(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
COMMENT VARCHAR(max) NOT NULL,
|
||||
ROOT_PARENT_ID INTEGER NOT NULL,
|
||||
IMMEDIATE_PARENT_ID INTEGER NOT NULL,
|
||||
CREATED_AT DATETIME2(0) NOT NULL,
|
||||
MODIFIED_AT DATETIME2(0) NOT NULL,
|
||||
RATING INTEGER NULL,
|
||||
USERNAME VARCHAR(45) NOT NULL,
|
||||
ACTIVE_REVIEW BIT NOT NULL DEFAULT TRUE,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_LIFECYCLE_STATE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_LIFECYCLE_STATE(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
CURRENT_STATE VARCHAR(45) NOT NULL,
|
||||
PREVIOUS_STATE VARCHAR(45) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
UPDATED_BY VARCHAR(100) NOT NULL,
|
||||
UPDATED_AT DATETIME2(0) NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
REASON VARCHAR(max) DEFAULT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_TAG
|
||||
-- ----------------------------------------------------
|
||||
CREATE TABLE AP_APP_TAG(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
TAG VARCHAR(100) NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_DEVICE_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_DEVICE_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
|
||||
UNSUBSCRIBED BIT NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
|
||||
ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
|
||||
STATUS VARCHAR(45) NOT NULL,
|
||||
DM_DEVICE_ID INTEGER NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_GROUP_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_GROUP_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
|
||||
UNSUBSCRIBED BIT NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
|
||||
GROUP_NAME VARCHAR(100) NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_ROLE_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_ROLE_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
ROLE_NAME VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
|
||||
UNSUBSCRIBED BIT NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_UNRESTRICTED_ROLE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_UNRESTRICTED_ROLE(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
ROLE VARCHAR(45) NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_USER_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_USER_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
USER_NAME VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP DATETIME2(0) NOT NULL,
|
||||
UNSUBSCRIBED BIT NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP DATETIME2(0) NULL DEFAULT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_CATEGORY
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_CATEGORY(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
CATEGORY VARCHAR(45) NOT NULL,
|
||||
CATEGORY_ICON VARCHAR(45) NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_TAG_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_TAG_MAPPING(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
AP_APP_TAG_ID INTEGER NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1
|
||||
FOREIGN KEY (AP_APP_TAG_ID)
|
||||
REFERENCES AP_APP_TAG (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx ON AP_APP_TAG_MAPPING (AP_APP_TAG_ID ASC);
|
||||
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_CATEGORY_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_CATEGORY_MAPPING(
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
AP_APP_CATEGORY_ID INTEGER NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1
|
||||
FOREIGN KEY (AP_APP_CATEGORY_ID)
|
||||
REFERENCES AP_APP_CATEGORY (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_CATEGORY_ID ASC);
|
||||
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_SUB_OP_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_APP_SUB_OP_MAPPING (
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
OPERATION_ID INTEGER NOT NULL,
|
||||
AP_DEVICE_SUBSCRIPTION_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1
|
||||
FOREIGN KEY (AP_DEVICE_SUBSCRIPTION_ID)
|
||||
REFERENCES AP_DEVICE_SUBSCRIPTION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_OP_MAPPING (AP_DEVICE_SUBSCRIPTION_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_SCHEDULED_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE AP_SCHEDULED_SUBSCRIPTION(
|
||||
ID INT IDENTITY(1, 1) NOT NULL,
|
||||
TASK_NAME VARCHAR(100) NOT NULL,
|
||||
APPLICATION_UUID VARCHAR(36) NOT NULL,
|
||||
SUBSCRIBER_LIST VARCHAR(MAX) NOT NULL,
|
||||
STATUS VARCHAR(15) NOT NULL,
|
||||
SCHEDULED_AT DATETIME NOT NULL,
|
||||
SCHEDULED_BY VARCHAR(100) NOT NULL,
|
||||
SCHEDULED_TIMESTAMP DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
DELETED BIT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
FOREIGN KEY (APPLICATION_UUID) REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
)
|
||||
|
||||
CREATE INDEX FK_PLATFROM_TENANT_MAPPING_PLATFORM ON APPM_PLATFORM_TENANT_MAPPING(PLATFORM_ID ASC);
|
||||
ID INTEGER NOT NULL IDENTITY,
|
||||
TASK_NAME VARCHAR(100) NOT NULL,
|
||||
APPLICATION_UUID VARCHAR(36) NOT NULL,
|
||||
SUBSCRIBER_LIST LONGVARCHAR NOT NULL,
|
||||
STATUS VARCHAR(15) NOT NULL,
|
||||
SCHEDULED_AT DATETIME2(0) NOT NULL,
|
||||
SCHEDULED_BY VARCHAR(100) NOT NULL,
|
||||
SCHEDULED_TIMESTAMP DATETIME2(0) NOT NULL,
|
||||
DELETED BIT,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE
|
||||
FOREIGN KEY (APPLICATION_UUID)
|
||||
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
@ -1,354 +1,280 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP`
|
||||
-- Table AP_APP
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`NAME` VARCHAR(45) NOT NULL,
|
||||
`DESCRIPTION` TEXT NULL,
|
||||
`TYPE` VARCHAR(200) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`STATUS` VARCHAR(45) NOT NULL DEFAULT 'ACTIVE ',
|
||||
`SUB_TYPE` VARCHAR(45) NOT NULL,
|
||||
`CURRENCY` VARCHAR(45) NULL DEFAULT '$',
|
||||
`RATING` INT(11) NULL,
|
||||
`DEVICE_TYPE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
NAME VARCHAR(45) NOT NULL,
|
||||
DESCRIPTION CLOB NULL,
|
||||
TYPE VARCHAR(200) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
STATUS VARCHAR(45) NOT NULL DEFAULT 'ACTIVE',
|
||||
SUB_TYPE VARCHAR(45) NOT NULL,
|
||||
CURRENCY VARCHAR(45) NULL DEFAULT '$',
|
||||
RATING DOUBLE NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_RELEASE`
|
||||
-- Table AP_APP_RELEASE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_RELEASE`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`DESCRIPTION` TEXT NOT NULL,
|
||||
`VERSION` VARCHAR(70) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`UUID` VARCHAR(200) NOT NULL,
|
||||
`RELEASE_TYPE` VARCHAR(45) NOT NULL,
|
||||
`APP_PRICE` DECIMAL(6, 2) NULL DEFAULT NULL,
|
||||
`STORED_LOCATION` VARCHAR(45) NOT NULL,
|
||||
`BANNER_LOCATION` VARCHAR(45) NOT NULL,
|
||||
`SC_1_LOCATION` VARCHAR(45) NOT NULL,
|
||||
`SC_2_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`SC_3_LOCATION` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`APP_HASH_VALUE` VARCHAR(1000) NOT NULL,
|
||||
`SHARED_WITH_ALL_TENANTS` TINYINT(1) NULL DEFAULT NULL,
|
||||
`APP_META_INFO` TEXT NULL DEFAULT NULL,
|
||||
`PACKAGE_NAME` VARCHAR(45) NOT NULL,
|
||||
`SUPPORTED_OS_VERSIONS` VARCHAR(45) NULL,
|
||||
`RATING` DOUBLE NULL DEFAULT NULL,
|
||||
`CURRENT_STATE` VARCHAR(45) NULL,
|
||||
`RATED_USERS` INT(11) NULL,
|
||||
`AP_APP_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_RELEASE_AP_APP1_idx` (`AP_APP_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_RELEASE_AP_APP1`
|
||||
FOREIGN KEY (`AP_APP_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_RELEASE(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
DESCRIPTION CLOB NOT NULL,
|
||||
VERSION VARCHAR(70) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
UUID VARCHAR(200) NOT NULL,
|
||||
RELEASE_TYPE VARCHAR(45) NOT NULL,
|
||||
PACKAGE_NAME VARCHAR(45) NOT NULL,
|
||||
APP_PRICE DECIMAL(6, 2) NULL DEFAULT NULL,
|
||||
INSTALLER_LOCATION VARCHAR(100) NOT NULL,
|
||||
ICON_LOCATION VARCHAR(100) NOT NULL,
|
||||
BANNER_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
SC_1_LOCATION VARCHAR(100) NOT NULL,
|
||||
SC_2_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
SC_3_LOCATION VARCHAR(100) NULL DEFAULT NULL,
|
||||
APP_HASH_VALUE VARCHAR(1000) NOT NULL,
|
||||
SHARED_WITH_ALL_TENANTS BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
APP_META_INFO CLOB NULL DEFAULT NULL,
|
||||
SUPPORTED_OS_VERSIONS VARCHAR(45) NOT NULL,
|
||||
RATING DOUBLE NULL DEFAULT NULL,
|
||||
CURRENT_STATE VARCHAR(45) NOT NULL,
|
||||
RATED_USERS INTEGER NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_RELEASE_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_RELEASE_AP_APP1_idx ON AP_APP_RELEASE (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_REVIEW`
|
||||
-- Table AP_APP_REVIEW
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_REVIEW`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`COMMENT` TEXT NOT NULL,
|
||||
`ROOT_PARENT_ID` INT(11) NOT NULL,
|
||||
`IMMEDIATE_PARENT_ID` INT(11) NOT NULL,
|
||||
`CREATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`MODIFIED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`RATING` INT(11) NOT NULL,
|
||||
`USERNAME` VARCHAR(45) NOT NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_REVIEW_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_REVIEW_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_REVIEW(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
COMMENT TEXT NOT NULL,
|
||||
ROOT_PARENT_ID INTEGER NOT NULL,
|
||||
IMMEDIATE_PARENT_ID INTEGER NOT NULL,
|
||||
CREATED_AT TIMESTAMP NOT NULL,
|
||||
MODIFIED_AT TIMESTAMP NOT NULL,
|
||||
RATING INTEGER NULL,
|
||||
USERNAME VARCHAR(45) NOT NULL,
|
||||
ACTIVE_REVIEW BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_COMMENT_AP_APP_RELEASE1_idx ON AP_APP_REVIEW (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
|
||||
-- Table AP_APP_LIFECYCLE_STATE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_LIFECYCLE_STATE`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`CURRENT_STATE` VARCHAR(45) NOT NULL,
|
||||
`PREVIOUS_STATE` VARCHAR(45) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`UPDATED_BY` VARCHAR(100) NOT NULL,
|
||||
`UPDATED_AT` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`REASON` VARCHAR(45) NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
CURRENT_STATE VARCHAR(45) NOT NULL,
|
||||
PREVIOUS_STATE VARCHAR(45) NOT NULL,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
UPDATED_BY VARCHAR(100) NOT NULL,
|
||||
UPDATED_AT TIMESTAMP NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
REASON TEXT DEFAULT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_STATE( AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_TAG`
|
||||
-- Table AP_APP_TAG
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TAG` VARCHAR(100) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_TAG(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
TAG VARCHAR(100) NOT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
|
||||
-- Table AP_DEVICE_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
|
||||
`ACTION_TRIGGERED_FROM` VARCHAR(45) NULL,
|
||||
`DM_DEVICE_ID` INT(11) NOT NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
CONSTRAINT `fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
|
||||
ACTION_TRIGGERED_FROM VARCHAR(45) NOT NULL,
|
||||
STATUS VARCHAR(45) NOT NULL,
|
||||
DM_DEVICE_ID INTEGER NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
|
||||
-- Table AP_GROUP_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_GROUP_SUBSCRIPTION`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
|
||||
`GROUP_NAME` VARCHAR(100) NOT NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
INDEX `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_GROUP_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
|
||||
GROUP_NAME VARCHAR(100) NOT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_GROUP_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_GROUP_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
|
||||
-- Table AP_ROLE_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_ROLE_SUBSCRIPTION`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`ROLE_NAME` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
CONSTRAINT `fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_ROLE_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
ROLE_NAME VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_ROLE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_ROLE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
|
||||
-- Table AP_UNRESTRICTED_ROLE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_UNRESTRICTED_ROLE`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`ROLE` VARCHAR(100) NOT NULL,
|
||||
`AP_APP_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_VISIBILITY_AP_APP1_idx` (`AP_APP_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_VISIBILITY_AP_APP1`
|
||||
FOREIGN KEY (`AP_APP_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_UNRESTRICTED_ROLE(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
ROLE VARCHAR(45) NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_VISIBILITY_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_VISIBILITY_AP_APP1_idx ON AP_UNRESTRICTED_ROLE (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
|
||||
-- Table AP_USER_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_USER_SUBSCRIPTION`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`USER_NAME` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_BY` VARCHAR(100) NOT NULL,
|
||||
`SUBSCRIBED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
`UNSUBSCRIBED` TINYINT(1) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_BY` VARCHAR(100) NULL DEFAULT NULL,
|
||||
`UNSUBSCRIBED_TIMESTAMP` TIMESTAMP NULL DEFAULT NULL,
|
||||
`AP_APP_RELEASE_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx` (`AP_APP_RELEASE_ID` ASC),
|
||||
CONSTRAINT `fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1`
|
||||
FOREIGN KEY (`AP_APP_RELEASE_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_RELEASE` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_USER_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
USER_NAME VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_BY VARCHAR(100) NOT NULL,
|
||||
SUBSCRIBED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||
UNSUBSCRIBED BOOLEAN NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_BY VARCHAR(100) NULL DEFAULT NULL,
|
||||
UNSUBSCRIBED_TIMESTAMP TIMESTAMP NULL DEFAULT NULL,
|
||||
AP_APP_RELEASE_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1
|
||||
FOREIGN KEY (AP_APP_RELEASE_ID)
|
||||
REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_USER_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_USER_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_CATEGORY`
|
||||
-- Table AP_APP_CATEGORY
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`CATEGORY` VARCHAR(45) NOT NULL,
|
||||
`CATEGORY_ICON` VARCHAR(45) NULL,
|
||||
`TENANT_ID` INT(11) NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
CATEGORY VARCHAR(45) NOT NULL,
|
||||
CATEGORY_ICON VARCHAR(45) NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_TAG_MAPPING`
|
||||
-- Table AP_APP_TAG_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_TAG_MAPPING`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`AP_APP_TAG_ID` INT(11) NOT NULL,
|
||||
`AP_APP_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx` (`AP_APP_TAG_ID` ASC),
|
||||
INDEX `fk_AP_APP_TAG_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_TAG_copy1_AP_APP_TAG1`
|
||||
FOREIGN KEY (`AP_APP_TAG_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_TAG` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_AP_APP_TAG_copy1_AP_APP1`
|
||||
FOREIGN KEY (`AP_APP_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_TAG_MAPPING(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
AP_APP_TAG_ID INTEGER NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP_TAG1
|
||||
FOREIGN KEY (AP_APP_TAG_ID)
|
||||
REFERENCES AP_APP_TAG (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_AP_APP_TAG_copy1_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP_TAG1_idx ON AP_APP_TAG_MAPPING (AP_APP_TAG_ID ASC);
|
||||
CREATE INDEX fk_AP_APP_TAG_copy1_AP_APP1_idx ON AP_APP_TAG_MAPPING (AP_APP_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
|
||||
-- Table AP_APP_CATEGORY_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_CATEGORY_MAPPING`
|
||||
(
|
||||
`ID` INT(11) NOT NULL,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`AP_APP_CATEGORY_ID` INT(11) NOT NULL,
|
||||
`AP_APP_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx` (`AP_APP_CATEGORY_ID` ASC),
|
||||
INDEX `fk_AP_APP_CATEGORY_copy1_AP_APP1_idx` (`AP_APP_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1`
|
||||
FOREIGN KEY (`AP_APP_CATEGORY_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP_CATEGORY` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_AP_APP_CATEGORY_copy1_AP_APP1`
|
||||
FOREIGN KEY (`AP_APP_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_APP` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_CATEGORY_MAPPING(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
AP_APP_CATEGORY_ID INTEGER NOT NULL,
|
||||
AP_APP_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1
|
||||
FOREIGN KEY (AP_APP_CATEGORY_ID)
|
||||
REFERENCES AP_APP_CATEGORY (ID) ON DELETE NO ACTION ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_AP_APP_CATEGORY_copy1_AP_APP1
|
||||
FOREIGN KEY (AP_APP_ID)
|
||||
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP_CATEGORY1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_CATEGORY_ID ASC);
|
||||
CREATE INDEX fk_AP_APP_CATEGORY_copy1_AP_APP1_idx ON AP_APP_CATEGORY_MAPPING (AP_APP_ID ASC);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_APP_OP_DEVICE_MAPPING` (
|
||||
`ID` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`TENANT_ID` INT(11) NOT NULL,
|
||||
`OPERATION_ID` INT(11) NOT NULL,
|
||||
`AP_DEVICE_SUBSCRIPTION_ID` INT(11) NOT NULL,
|
||||
PRIMARY KEY (`ID`),
|
||||
INDEX `fk_AP_APP_OP_DEVICE_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx` (`AP_DEVICE_SUBSCRIPTION_ID` ASC),
|
||||
CONSTRAINT `fk_AP_APP_OP_DEVICE_MAPPING_AP_DEVICE_SUBSCRIPTION1`
|
||||
FOREIGN KEY (`AP_DEVICE_SUBSCRIPTION_ID`)
|
||||
REFERENCES `APP_MANAGER`.`AP_DEVICE_SUBSCRIPTION` (`ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
-- -----------------------------------------------------
|
||||
-- Table AP_APP_SUB_OP_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AP_APP_SUB_OP_MAPPING (
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TENANT_ID INTEGER NOT NULL,
|
||||
OPERATION_ID INTEGER NOT NULL,
|
||||
AP_DEVICE_SUBSCRIPTION_ID INTEGER NOT NULL,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1
|
||||
FOREIGN KEY (AP_DEVICE_SUBSCRIPTION_ID)
|
||||
REFERENCES AP_DEVICE_SUBSCRIPTION (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_OP_MAPPING (AP_DEVICE_SUBSCRIPTION_ID ASC);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `APP_MANAGER`.`AP_SCHEDULED_SUBSCRIPTION`
|
||||
-- Table AP_SCHEDULED_SUBSCRIPTION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `APP_MANAGER`.`AP_SCHEDULED_SUBSCRIPTION`(
|
||||
`ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`TASK_NAME` VARCHAR(100) NOT NULL,
|
||||
`APPLICATION_UUID` VARCHAR(36) NOT NULL,
|
||||
`SUBSCRIBER_LIST` TEXT NOT NULL,
|
||||
`STATUS` VARCHAR(15) NOT NULL,
|
||||
`SCHEDULED_AT` TIMESTAMP NOT NULL,
|
||||
`SCHEDULED_BY` VARCHAR(100) NOT NULL,
|
||||
`SCHEDULED_TIMESTAMP` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`DELETED` BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (`ID`),
|
||||
CONSTRAINT `fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE`
|
||||
FOREIGN KEY (`APPLICATION_UUID`)
|
||||
REFERENCES `AP_APP_RELEASE` (`UUID`) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
DEFAULT CHARACTER SET = utf8;
|
||||
CREATE TABLE IF NOT EXISTS AP_SCHEDULED_SUBSCRIPTION(
|
||||
ID INTEGER NOT NULL AUTO_INCREMENT,
|
||||
TASK_NAME VARCHAR(100) NOT NULL,
|
||||
APPLICATION_UUID VARCHAR(36) NOT NULL,
|
||||
SUBSCRIBER_LIST LONGVARCHAR NOT NULL,
|
||||
STATUS VARCHAR(15) NOT NULL,
|
||||
SCHEDULED_AT TIMESTAMP NOT NULL,
|
||||
SCHEDULED_BY VARCHAR(100) NOT NULL,
|
||||
SCHEDULED_TIMESTAMP TIMESTAMP NOT NULL,
|
||||
DELETED BOOLEAN,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_AP_SCHEDULED_SUBSCRIPTION_AP_APP_RELEASE
|
||||
FOREIGN KEY (APPLICATION_UUID)
|
||||
REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
||||
|
Loading…
Reference in new issue