analytics/models.py: Add subgroup column to unique_together constraints.

This commit is contained in:
umkay 2016-10-31 17:51:58 -07:00 committed by Tim Abbott
parent 148e1e6add
commit a94599fca7
2 changed files with 34 additions and 4 deletions

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('analytics', '0005_alter_field_size'),
]
operations = [
migrations.AlterUniqueTogether(
name='installationcount',
unique_together=set([('property', 'subgroup', 'end_time', 'interval')]),
),
migrations.AlterUniqueTogether(
name='realmcount',
unique_together=set([('realm', 'property', 'subgroup', 'end_time', 'interval')]),
),
migrations.AlterUniqueTogether(
name='streamcount',
unique_together=set([('stream', 'property', 'subgroup', 'end_time', 'interval')]),
),
migrations.AlterUniqueTogether(
name='usercount',
unique_together=set([('user', 'property', 'subgroup', 'end_time', 'interval')]),
),
]

View File

@ -74,7 +74,7 @@ class BaseCount(ModelReprMixin, models.Model):
class InstallationCount(BaseCount):
class Meta(object):
unique_together = ("property", "end_time", "interval")
unique_together = ("property", "subgroup", "end_time", "interval")
@staticmethod
def extended_id():
@ -94,7 +94,7 @@ class RealmCount(BaseCount):
realm = models.ForeignKey(Realm)
class Meta(object):
unique_together = ("realm", "property", "end_time", "interval")
unique_together = ("realm", "property", "subgroup", "end_time", "interval")
@staticmethod
def extended_id():
@ -115,7 +115,7 @@ class UserCount(BaseCount):
realm = models.ForeignKey(Realm)
class Meta(object):
unique_together = ("user", "property", "end_time", "interval")
unique_together = ("user", "property", "subgroup", "end_time", "interval")
@staticmethod
def extended_id():
@ -136,7 +136,7 @@ class StreamCount(BaseCount):
realm = models.ForeignKey(Realm)
class Meta(object):
unique_together = ("stream", "property", "end_time", "interval")
unique_together = ("stream", "property", "subgroup", "end_time", "interval")
@staticmethod
def extended_id():