Browse Source

Add index on api_check (status, user, alert_after), will be used in sendalerts management command.

pull/7/head
Pēteris Caune 9 years ago
parent
commit
a4afd70fef
2 changed files with 23 additions and 0 deletions
  1. +18
    -0
      hc/api/migrations/0015_auto_20151022_1008.py
  2. +5
    -0
      hc/api/models.py

+ 18
- 0
hc/api/migrations/0015_auto_20151022_1008.py View File

@ -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')]),
),
]

+ 5
- 0
hc/api/models.py View File

@ -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)


Loading…
Cancel
Save