[buildinfo.debian.net] 01/07: Drop big unique_together index...

Chris Lamb chris at chris-lamb.co.uk
Sat Jan 28 21:58:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository buildinfo.debian.net.

commit 897746e9557f3bae3e2ca01f554e57a767e50f9c
Author: Chris Lamb <lamby at debian.org>
Date:   Thu Jan 19 13:59:11 2017 +1100

    Drop big unique_together index...
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 bidb/api/utils.py                                    | 14 ++++++++------
 bidb/buildinfo/migrations/0003_auto_20170119_0258.py | 19 +++++++++++++++++++
 bidb/buildinfo/models.py                             |  3 ++-
 3 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/bidb/api/utils.py b/bidb/api/utils.py
index 653e9b2..4e75f37 100644
--- a/bidb/api/utils.py
+++ b/bidb/api/utils.py
@@ -154,13 +154,15 @@ def parse_submission(request):
 
         binary = Binary.objects.get_or_create(name=m.group('package'))[0]
 
-        try:
-            buildinfo.installed_build_depends.create(
-                binary=binary,
-                version=m.group('version'),
-            )
-        except IntegrityError:
+        if buildinfo.installed_build_depends.filter(
+            binary=binary,
+        ).exists():
             raise InvalidSubmission("Duplicate entry in "
                 "Installed-Build-Depends: {}".format(binary.name))
 
+        buildinfo.installed_build_depends.create(
+            binary=binary,
+            version=m.group('version'),
+        )
+
     return create_submission(buildinfo), True
diff --git a/bidb/buildinfo/migrations/0003_auto_20170119_0258.py b/bidb/buildinfo/migrations/0003_auto_20170119_0258.py
new file mode 100644
index 0000000..e8f310b
--- /dev/null
+++ b/bidb/buildinfo/migrations/0003_auto_20170119_0258.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.11 on 2017-01-19 02:58
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('buildinfo', '0002_auto_20161204_1921'),
+    ]
+
+    operations = [
+        migrations.AlterUniqueTogether(
+            name='installedbuilddepends',
+            unique_together=set([]),
+        ),
+    ]
diff --git a/bidb/buildinfo/models.py b/bidb/buildinfo/models.py
index cae495e..6914a51 100644
--- a/bidb/buildinfo/models.py
+++ b/bidb/buildinfo/models.py
@@ -142,7 +142,8 @@ class InstalledBuildDepends(models.Model):
         ordering = ('binary__name',)
         get_latest_by = 'created'
         unique_together = (
-            ('buildinfo', 'binary'),
+            # We should really have a ('buildinfo', 'binary') here, but it
+            # uses a rather lot of disk space.
         )
 
     def __unicode__(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/buildinfo.debian.net.git



More information about the Reproducible-commits mailing list