From: Richard Millet Date: Fri, 31 Aug 2018 18:52:00 +0000 (-0700) Subject: Add a database unique constraint to prevent duplicate relationships from being created. X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=1d4931746539792b22690ea2431204064bb19d23;p=tmp%2Fjakarta-migration.git Add a database unique constraint to prevent duplicate relationships from being created. --- diff --git a/3rdparty/nuxeo/nuxeo-server/7.10-HF17/config/vcsconfig.sql.txt b/3rdparty/nuxeo/nuxeo-server/7.10-HF17/config/vcsconfig.sql.txt index aef9cbb49..bbc090f90 100644 --- a/3rdparty/nuxeo/nuxeo-server/7.10-HF17/config/vcsconfig.sql.txt +++ b/3rdparty/nuxeo/nuxeo-server/7.10-HF17/config/vcsconfig.sql.txt @@ -27,3 +27,14 @@ SELECT constraint_name FROM information_schema.constraint_column_usage WHERE tab #IF: emptyResult ALTER TABLE batch_common add CONSTRAINT batchname_unique UNIQUE (name); + +# +# Add constraint to the relations table to prevent duplicate relationships +# +LOG.INFO Adding constraint to the relations table to prevent duplicate relationships + +#TEST: +SELECT constraint_name FROM information_schema.constraint_column_usage WHERE table_name = 'relations_common' AND constraint_name = 'relations_unique'; + +#IF: emptyResult +ALTER TABLE relations_common add CONSTRAINT relations_unique UNIQUE (subjectcsid, subjectrefname, predicate, objectcsid, objectrefname);