Merge pull request 'Add db scripts for VPP feature' (#179) from osh.silva/device-mgt-core:vpp-db-scripts into vpp-v2

Reviewed-on: community/device-mgt-core#179
mssqldbscriptfix
Inosh Perara 1 year ago
commit ec88734831

@ -325,3 +325,57 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
FOREIGN KEY (AP_APP_ID) FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
-- -----------------------------------------------------
-- Table AP_VPP_USER
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_USER (
ID INT NOT NULL AUTO_INCREMENT,
CLIENT_USER_ID VARCHAR(255) NULL,
DM_USERNAME VARCHAR(255) NOT NULL,
TENANT_ID INT NOT NULL,
EMAIL VARCHAR(255) NULL,
INVITE_CODE VARCHAR(255) NULL,
STATUS VARCHAR(255) NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
MANAGED_ID VARCHAR(255) NULL,
TEMP_PASSWORD VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_ASSETS
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_ASSETS (
ID INT NOT NULL AUTO_INCREMENT,
APP_ID INT NULL,
TENANT_ID INT NOT NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
ADAM_ID VARCHAR(255) NULL,
ASSIGNED_COUNT VARCHAR(255) NULL,
DEVICE_ASSIGNABLE VARCHAR(255) NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRODUCT_TYPE VARCHAR(255) NULL,
RETIRED_COUNT VARCHAR(255) NULL,
REVOCABLE VARCHAR(255) NULL,
SUPPORTED_PLATFORMS VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_VPP_ASSOCIATION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION (
ID INT NOT NULL AUTO_INCREMENT,
ASSET_ID INT,
USER_ID INT,
TENANT_ID INT NOT NULL,
ASSOCIATION_TYPE VARCHAR(255) NOT NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRIMARY KEY (ID),
CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

@ -342,3 +342,59 @@ CREATE TABLE AP_APP_FAVOURITES(
FOREIGN KEY (AP_APP_ID) FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) REFERENCES AP_APP (ID)
); );
-- -----------------------------------------------------
-- Table AP_VPP_USER
-- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_VPP_USER') AND type in (N'U'))
CREATE TABLE AP_VPP_USER (
ID INT NOT NULL IDENTITY(1,1),
CLIENT_USER_ID VARCHAR(255) NULL,
DM_USERNAME VARCHAR(255) NOT NULL,
TENANT_ID INT NOT NULL,
EMAIL VARCHAR(255) NULL,
INVITE_CODE VARCHAR(255) NULL,
STATUS VARCHAR(255) NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
MANAGED_ID VARCHAR(255) NULL,
TEMP_PASSWORD VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_ASSETS
-- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_ASSETS') AND type in (N'U'))
CREATE TABLE AP_ASSETS (
ID INT NOT NULL IDENTITY(1,1),
APP_ID INT NULL,
TENANT_ID INT NOT NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
ADAM_ID VARCHAR(255) NULL,
ASSIGNED_COUNT VARCHAR(255) NULL,
DEVICE_ASSIGNABLE VARCHAR(255) NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRODUCT_TYPE VARCHAR(255) NULL,
RETIRED_COUNT VARCHAR(255) NULL,
REVOCABLE VARCHAR(255) NULL,
SUPPORTED_PLATFORMS VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_VPP_ASSOCIATION
-- -----------------------------------------------------
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'AP_VPP_ASSOCIATION') AND type in (N'U'))
CREATE TABLE AP_VPP_ASSOCIATION (
ID INT NOT NULL IDENTITY(1,1),
ASSET_ID INT,
USER_ID INT,
TENANT_ID INT NOT NULL,
ASSOCIATION_TYPE VARCHAR(255) NOT NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRIMARY KEY (ID),
CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

@ -273,3 +273,57 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
PRIMARY KEY(ID), PRIMARY KEY(ID),
CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID) CONSTRAINT AP_APP_FAVOURITES_AP_APP_ID_fk FOREIGN KEY (AP_APP_ID) REFERENCES AP_APP (ID)
); );
-- -----------------------------------------------------
-- Table AP_VPP_USER
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_USER (
ID INT NOT NULL AUTO_INCREMENT,
CLIENT_USER_ID VARCHAR(255) NULL,
DM_USERNAME VARCHAR(255) NOT NULL,
TENANT_ID INT NOT NULL,
EMAIL VARCHAR(255) NULL,
INVITE_CODE VARCHAR(255) NULL,
STATUS VARCHAR(255) NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
MANAGED_ID VARCHAR(255) NULL,
TEMP_PASSWORD VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_ASSETS
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_ASSETS (
ID INT NOT NULL AUTO_INCREMENT,
APP_ID INT NULL,
TENANT_ID INT NOT NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
ADAM_ID VARCHAR(255) NULL,
ASSIGNED_COUNT VARCHAR(255) NULL,
DEVICE_ASSIGNABLE VARCHAR(255) NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRODUCT_TYPE VARCHAR(255) NULL,
RETIRED_COUNT VARCHAR(255) NULL,
REVOCABLE VARCHAR(255) NULL,
SUPPORTED_PLATFORMS VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_VPP_ASSOCIATION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION (
ID INT NOT NULL AUTO_INCREMENT,
ASSET_ID INT,
USER_ID INT,
TENANT_ID INT NOT NULL,
ASSOCIATION_TYPE VARCHAR(255) NOT NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRIMARY KEY (ID),
CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

@ -420,3 +420,50 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
REFERENCES AP_APP (ID) REFERENCES AP_APP (ID)
) )
/ /
CREATE TABLE AP_VPP_USER (
ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
CLIENT_USER_ID VARCHAR2(255) NULL,
DM_USERNAME VARCHAR2(255) NOT NULL,
TENANT_ID INT NOT NULL,
EMAIL VARCHAR2(255) NULL,
INVITE_CODE VARCHAR2(255) NULL,
STATUS VARCHAR2(255) NULL,
CREATED_TIME NUMBER(19) NULL,
LAST_UPDATED_TIME NUMBER(19) NULL,
MANAGED_ID VARCHAR2(255) NULL,
TEMP_PASSWORD VARCHAR2(255) NULL,
PRIMARY KEY (ID)
)
/
CREATE TABLE AP_ASSETS (
ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
APP_ID INT NULL,
TENANT_ID INT NOT NULL,
CREATED_TIME NUMBER(19) NULL,
LAST_UPDATED_TIME NUMBER(19) NULL,
ADAM_ID VARCHAR2(255) NULL,
ASSIGNED_COUNT VARCHAR2(255) NULL,
DEVICE_ASSIGNABLE VARCHAR2(255) NULL,
PRICING_PARAMS VARCHAR2(255) NULL,
PRODUCT_TYPE VARCHAR2(255) NULL,
RETIRED_COUNT VARCHAR2(255) NULL,
REVOCABLE VARCHAR2(255) NULL,
SUPPORTED_PLATFORMS VARCHAR2(255) NULL,
PRIMARY KEY (ID)
)
/
CREATE TABLE AP_VPP_ASSOCIATION (
ID number GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL,
ASSET_ID INT,
USER_ID INT,
TENANT_ID INT NOT NULL,
ASSOCIATION_TYPE VARCHAR2(255) NOT NULL,
PRICING_PARAMS VARCHAR2(255) NULL,
PRIMARY KEY (ID),
CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE,
CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE
)
/

@ -352,3 +352,56 @@ CREATE TABLE IF NOT EXISTS AP_APP_FAVOURITES(
FOREIGN KEY (AP_APP_ID) FOREIGN KEY (AP_APP_ID)
REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION REFERENCES AP_APP (ID) ON DELETE NO ACTION ON UPDATE NO ACTION
); );
-- -----------------------------------------------------
-- Table AP_VPP_USER
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_USER (
ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_VPP_USER_seq'),
CLIENT_USER_ID VARCHAR(255) NULL,
DM_USERNAME VARCHAR(255) NOT NULL,
TENANT_ID INTEGER NOT NULL,
EMAIL VARCHAR(255) NULL,
INVITE_CODE VARCHAR(255) NULL,
STATUS VARCHAR(255) NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
MANAGED_ID VARCHAR(255) NULL,
TEMP_PASSWORD VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_ASSETS
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_ASSETS (
ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_ASSETS_seq'),
APP_ID INTEGER NULL,
TENANT_ID INTEGER NOT NULL,
CREATED_TIME BIGINT NULL,
LAST_UPDATED_TIME BIGINT NULL,
ADAM_ID VARCHAR(255) NULL,
ASSIGNED_COUNT VARCHAR(255) NULL,
DEVICE_ASSIGNABLE VARCHAR(255) NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRODUCT_TYPE VARCHAR(255) NULL,
RETIRED_COUNT VARCHAR(255) NULL,
REVOCABLE VARCHAR(255) NULL,
SUPPORTED_PLATFORMS VARCHAR(255) NULL,
PRIMARY KEY (ID)
);
-- -----------------------------------------------------
-- Table AP_VPP_ASSOCIATION
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS AP_VPP_ASSOCIATION (
ID INTEGER NOT NULL DEFAULT NEXTVAL('AP_VPP_ASSOCIATION_seq'),
ASSET_ID INTEGER,
USER_ID INTEGER,
TENANT_ID INTEGER NOT NULL,
ASSOCIATION_TYPE VARCHAR(255) NOT NULL,
PRICING_PARAMS VARCHAR(255) NULL,
PRIMARY KEY (ID),
CONSTRAINT AP_VPP_ASSETS_fk FOREIGN KEY (ASSET_ID) REFERENCES AP_ASSETS (ID) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT AP_VPP_VPP_USER_fk FOREIGN KEY (USER_ID) REFERENCES AP_VPP_USER (ID) ON DELETE CASCADE ON UPDATE CASCADE
);

Loading…
Cancel
Save