From 1d4931746539792b22690ea2431204064bb19d23 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Fri, 31 Aug 2018 11:52:00 -0700 Subject: [PATCH] Add a database unique constraint to prevent duplicate relationships from being created. --- .../nuxeo-server/7.10-HF17/config/vcsconfig.sql.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); -- 2.47.3