summaryrefslogtreecommitdiffstats
path: root/lib/sql
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2008-10-29 11:21:05 +1100
committerJeremy Kerr <jk@ozlabs.org>2008-10-29 11:21:05 +1100
commit74425beba0dc641509c5268571ea5328ac8185ec (patch)
treef9033b51d3b5608f398b5ce358ba202edefb10ad /lib/sql
parent4da08a17e860b6831f9446af46b2f562efeeb461 (diff)
downloadpatchwork-74425beba0dc641509c5268571ea5328ac8185ec.tar.bz2
patchwork-74425beba0dc641509c5268571ea5328ac8185ec.tar.xz
[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>
Diffstat (limited to 'lib/sql')
-rw-r--r--lib/sql/migration/004-msgid-uniqueness.sql7
1 files changed, 7 insertions, 0 deletions
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;