diff --git a/hc/api/migrations/0015_auto_20151022_1008.py b/hc/api/migrations/0015_auto_20151022_1008.py new file mode 100644 index 00000000..2fc857e9 --- /dev/null +++ b/hc/api/migrations/0015_auto_20151022_1008.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0014_auto_20151019_2039'), + ] + + operations = [ + migrations.AlterIndexTogether( + name='check', + index_together=set([('status', 'user', 'alert_after')]), + ), + ] diff --git a/hc/api/models.py b/hc/api/models.py index 08b37702..1f6e8281 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -25,6 +25,11 @@ CHANNEL_KINDS = (("email", "Email"), ("webhook", "Webhook"), class Check(models.Model): + + class Meta: + # sendalerts command will query using these + index_together = ["status", "user", "alert_after"] + name = models.CharField(max_length=100, blank=True) code = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True) user = models.ForeignKey(User, blank=True, null=True)