diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 873f74ee0d6..99330c303b6 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -1,16 +1,16 @@ -- ----------------------------------------------------- -- Table AP_APP -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS AP_APP( - ID INTEGER NOT NULL AUTO_INCREMENT, +CREATE TABLE AP_APP( + ID INTEGER NOT NULL IDENTITY, NAME VARCHAR(45) NOT NULL, - DESCRIPTION CLOB NULL, + DESCRIPTION VARCHAR(max) 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, + RATING FLOAT NULL DEFAULT NULL, DEVICE_TYPE_ID INTEGER NOT NULL, PRIMARY KEY (ID) ); @@ -34,7 +34,7 @@ CREATE TABLE AP_APP_RELEASE( 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, + SHARED_WITH_ALL_TENANTS BIT NOT NULL DEFAULT 0, APP_META_INFO VARCHAR(max) NULL DEFAULT NULL, SUPPORTED_OS_VERSIONS VARCHAR(45) NOT NULL, RATING FLOAT NULL DEFAULT NULL, @@ -42,13 +42,13 @@ CREATE TABLE AP_APP_RELEASE( RATED_USERS INTEGER NULL, AP_APP_ID INTEGER NOT NULL, PRIMARY KEY (ID), + CONSTRAINT UUID_CONSTRAINT UNIQUE (UUID), 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 -- ----------------------------------------------------- @@ -62,7 +62,7 @@ CREATE TABLE AP_APP_REVIEW( MODIFIED_AT DATETIME2(0) NOT NULL, RATING INTEGER NULL, USERNAME VARCHAR(45) NOT NULL, - ACTIVE_REVIEW BIT NOT NULL DEFAULT TRUE, + ACTIVE_REVIEW BIT NOT NULL DEFAULT 1, AP_APP_RELEASE_ID INTEGER NOT NULL, PRIMARY KEY (ID), CONSTRAINT fk_AP_APP_COMMENT_AP_APP_RELEASE1 @@ -92,7 +92,7 @@ CREATE INDEX fk_AP_APP_LIFECYCLE_STATE_AP_APP_RELEASE1_idx ON AP_APP_LIFECYCLE_S -- ----------------------------------------------------- -- Table AP_APP_TAG --- ---------------------------------------------------- +-- ----------------------------------------------------- CREATE TABLE AP_APP_TAG( ID INTEGER NOT NULL IDENTITY, TENANT_ID INTEGER NOT NULL, @@ -267,8 +267,9 @@ CREATE INDEX fk_AP_APP_SUB_OP_MAPPING_AP_DEVICE_SUBSCRIPTION1_idx ON AP_APP_SUB_ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( ID INTEGER NOT NULL IDENTITY, TASK_NAME VARCHAR(100) NOT NULL, - APPLICATION_UUID VARCHAR(36) NOT NULL, - SUBSCRIBER_LIST LONGVARCHAR NOT NULL, + APPLICATION_UUID VARCHAR(200) NOT NULL, + CONSTRAINT APPLICATION_UUID_CONSTRAINT UNIQUE(APPLICATION_UUID), + SUBSCRIBER_LIST VARCHAR NOT NULL, STATUS VARCHAR(15) NOT NULL, SCHEDULED_AT DATETIME2(0) NOT NULL, SCHEDULED_BY VARCHAR(100) NOT NULL, @@ -276,6 +277,6 @@ CREATE TABLE AP_SCHEDULED_SUBSCRIPTION( 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 + FOREIGN KEY (APPLICATION_UUID) + REFERENCES AP_APP_RELEASE (UUID) ON DELETE NO ACTION ON UPDATE NO ACTION ); \ No newline at end of file