From 6692eb3155ae06ecf119f4b72466d4d2168cfcaf Mon Sep 17 00:00:00 2001 From: Thilina Shashimal Senarath Date: Wed, 18 Oct 2023 14:43:47 +0530 Subject: [PATCH] Change unique key of the UM_SHARED_ROLE table by adding UM_MAIN_ROLE_TENANT_ID --- distribution/kernel/carbon-home/dbscripts/db2.sql | 2 +- distribution/kernel/carbon-home/dbscripts/h2.sql | 2 +- distribution/kernel/carbon-home/dbscripts/informix.sql | 2 +- distribution/kernel/carbon-home/dbscripts/mssql.sql | 2 +- distribution/kernel/carbon-home/dbscripts/mysql.sql | 2 +- distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql | 2 +- distribution/kernel/carbon-home/dbscripts/oracle.sql | 2 +- distribution/kernel/carbon-home/dbscripts/oracle_rac.sql | 2 +- distribution/kernel/carbon-home/dbscripts/postgresql.sql | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/distribution/kernel/carbon-home/dbscripts/db2.sql b/distribution/kernel/carbon-home/dbscripts/db2.sql index 681130cc9fc..272b4d88ddf 100644 --- a/distribution/kernel/carbon-home/dbscripts/db2.sql +++ b/distribution/kernel/carbon-home/dbscripts/db2.sql @@ -1101,7 +1101,7 @@ CREATE TABLE UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE )/ diff --git a/distribution/kernel/carbon-home/dbscripts/h2.sql b/distribution/kernel/carbon-home/dbscripts/h2.sql index 304cc174f2b..1ae53637dcb 100644 --- a/distribution/kernel/carbon-home/dbscripts/h2.sql +++ b/distribution/kernel/carbon-home/dbscripts/h2.sql @@ -612,7 +612,7 @@ CREATE TABLE IF NOT EXISTS UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE ); diff --git a/distribution/kernel/carbon-home/dbscripts/informix.sql b/distribution/kernel/carbon-home/dbscripts/informix.sql index 33185755a0e..a5a416f763b 100755 --- a/distribution/kernel/carbon-home/dbscripts/informix.sql +++ b/distribution/kernel/carbon-home/dbscripts/informix.sql @@ -635,7 +635,7 @@ CREATE TABLE IF NOT EXISTS UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE ); diff --git a/distribution/kernel/carbon-home/dbscripts/mssql.sql b/distribution/kernel/carbon-home/dbscripts/mssql.sql index 12173c955b5..3b19e82695f 100755 --- a/distribution/kernel/carbon-home/dbscripts/mssql.sql +++ b/distribution/kernel/carbon-home/dbscripts/mssql.sql @@ -809,7 +809,7 @@ CREATE TABLE UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID), FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ); diff --git a/distribution/kernel/carbon-home/dbscripts/mysql.sql b/distribution/kernel/carbon-home/dbscripts/mysql.sql index ad7c75d4b3f..55e1a761ab1 100644 --- a/distribution/kernel/carbon-home/dbscripts/mysql.sql +++ b/distribution/kernel/carbon-home/dbscripts/mysql.sql @@ -639,7 +639,7 @@ CREATE TABLE IF NOT EXISTS UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE )ENGINE INNODB; diff --git a/distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql b/distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql index dfe5177b13a..89bd99ba3a4 100644 --- a/distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql +++ b/distribution/kernel/carbon-home/dbscripts/mysql_cluster.sql @@ -583,7 +583,7 @@ CREATE TABLE IF NOT EXISTS UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE )ENGINE NDB; diff --git a/distribution/kernel/carbon-home/dbscripts/oracle.sql b/distribution/kernel/carbon-home/dbscripts/oracle.sql index 0fd6bd9423f..f8c6c29e915 100644 --- a/distribution/kernel/carbon-home/dbscripts/oracle.sql +++ b/distribution/kernel/carbon-home/dbscripts/oracle.sql @@ -1111,7 +1111,7 @@ CREATE TABLE UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE ) diff --git a/distribution/kernel/carbon-home/dbscripts/oracle_rac.sql b/distribution/kernel/carbon-home/dbscripts/oracle_rac.sql index 487cecefc68..1891b65c7b4 100644 --- a/distribution/kernel/carbon-home/dbscripts/oracle_rac.sql +++ b/distribution/kernel/carbon-home/dbscripts/oracle_rac.sql @@ -1099,7 +1099,7 @@ CREATE TABLE UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE ) diff --git a/distribution/kernel/carbon-home/dbscripts/postgresql.sql b/distribution/kernel/carbon-home/dbscripts/postgresql.sql index 803ad6acfe9..7cf6639bf39 100644 --- a/distribution/kernel/carbon-home/dbscripts/postgresql.sql +++ b/distribution/kernel/carbon-home/dbscripts/postgresql.sql @@ -758,7 +758,7 @@ CREATE TABLE UM_SHARED_ROLE( UM_SHARED_ROLE_TENANT_ID INTEGER NOT NULL, UM_MAIN_ROLE_TENANT_ID INTEGER NOT NULL, PRIMARY KEY (UM_ID), - UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID), + UNIQUE (UM_SHARED_ROLE_ID, UM_MAIN_ROLE_ID, UM_SHARED_ROLE_TENANT_ID), FOREIGN KEY (UM_SHARED_ROLE_ID, UM_SHARED_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE, FOREIGN KEY (UM_MAIN_ROLE_ID, UM_MAIN_ROLE_TENANT_ID) REFERENCES UM_HYBRID_ROLE(UM_ID, UM_TENANT_ID) ON DELETE CASCADE );