diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index bb85e18ffaf..f9c58618315 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -117,7 +117,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION( 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 + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID) ); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 754eaca1914..0c55006976f 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -118,7 +118,8 @@ CREATE TABLE AP_DEVICE_SUBSCRIPTION( 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 + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID) ); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql index 6070139961a..54ba58a9fe2 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mysql.sql @@ -104,7 +104,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION( 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 + 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, + CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID) ); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC); -- ----------------------------------------------------- diff --git a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index 946d720dfd5..e8e1dbb2250 100644 --- a/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/io.entgra.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -129,7 +129,8 @@ CREATE TABLE IF NOT EXISTS AP_DEVICE_SUBSCRIPTION( 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 + REFERENCES AP_APP_RELEASE (ID) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT uq_AP_DEVICE_SUBSCRIPTION UNIQUE (DM_DEVICE_ID, AP_APP_RELEASE_ID) ); CREATE INDEX fk_AP_DEVICE_SUBSCRIPTION_AP_APP_RELEASE1_idx ON AP_DEVICE_SUBSCRIPTION (AP_APP_RELEASE_ID ASC);