From 74425beba0dc641509c5268571ea5328ac8185ec Mon Sep 17 00:00:00 2001
From: Jeremy Kerr <jk@ozlabs.org>
Date: Wed, 29 Oct 2008 11:21:05 +1100
Subject: [models] Make patches unique on (msgid, project), not just (msgid)

On patchwork.ozlabs.org, we may see multiple patches for different
projects, but with the same message-id.

We want these patches to show up on both projects, so we need to change
the current UNIQUE contstraint on msgid.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 lib/sql/migration/004-msgid-uniqueness.sql | 7 +++++++
 1 file changed, 7 insertions(+)
 create mode 100644 lib/sql/migration/004-msgid-uniqueness.sql

(limited to 'lib/sql/migration/004-msgid-uniqueness.sql')

diff --git a/lib/sql/migration/004-msgid-uniqueness.sql b/lib/sql/migration/004-msgid-uniqueness.sql
new file mode 100644
index 0000000..1e8ac0b
--- /dev/null
+++ b/lib/sql/migration/004-msgid-uniqueness.sql
@@ -0,0 +1,7 @@
+BEGIN;
+ALTER TABLE patchwork_patch DROP CONSTRAINT "patchwork_patch_msgid_key";
+ALTER TABLE patchwork_comment DROP CONSTRAINT "patchwork_comment_msgid_key";
+
+ALTER TABLE patchwork_patch ADD UNIQUE ("msgid", "project_id");
+ALTER TABLE patchwork_comment ADD UNIQUE ("msgid", "patch_id");
+COMMIT;
-- 
cgit v1.2.3

