From 88bd760925bbf795002ab2eeb08259092797fb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 19 Oct 2015 23:41:04 +0300 Subject: [PATCH] api_check.code should be indexed --- hc/api/migrations/0014_auto_20151019_2039.py | 20 ++++++++++++++++++++ hc/api/models.py | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 hc/api/migrations/0014_auto_20151019_2039.py diff --git a/hc/api/migrations/0014_auto_20151019_2039.py b/hc/api/migrations/0014_auto_20151019_2039.py new file mode 100644 index 00000000..382a7601 --- /dev/null +++ b/hc/api/migrations/0014_auto_20151019_2039.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0013_auto_20151001_2029'), + ] + + operations = [ + migrations.AlterField( + model_name='check', + name='code', + field=models.UUIDField(default=uuid.uuid4, db_index=True, editable=False), + ), + ] diff --git a/hc/api/models.py b/hc/api/models.py index 6069f4e6..08b37702 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -26,7 +26,7 @@ CHANNEL_KINDS = (("email", "Email"), ("webhook", "Webhook"), class Check(models.Model): name = models.CharField(max_length=100, blank=True) - code = models.UUIDField(default=uuid.uuid4, editable=False) + code = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True) user = models.ForeignKey(User, blank=True, null=True) created = models.DateTimeField(auto_now_add=True) timeout = models.DurationField(default=DEFAULT_TIMEOUT)