mirror of https://github.com/zulip/zulip.git
analytics/models.py: Add subgroup column to unique_together constraints.
This commit is contained in:
parent
148e1e6add
commit
a94599fca7
|
@ -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')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -74,7 +74,7 @@ class BaseCount(ModelReprMixin, models.Model):
|
||||||
class InstallationCount(BaseCount):
|
class InstallationCount(BaseCount):
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
unique_together = ("property", "end_time", "interval")
|
unique_together = ("property", "subgroup", "end_time", "interval")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extended_id():
|
def extended_id():
|
||||||
|
@ -94,7 +94,7 @@ class RealmCount(BaseCount):
|
||||||
realm = models.ForeignKey(Realm)
|
realm = models.ForeignKey(Realm)
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
unique_together = ("realm", "property", "end_time", "interval")
|
unique_together = ("realm", "property", "subgroup", "end_time", "interval")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extended_id():
|
def extended_id():
|
||||||
|
@ -115,7 +115,7 @@ class UserCount(BaseCount):
|
||||||
realm = models.ForeignKey(Realm)
|
realm = models.ForeignKey(Realm)
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
unique_together = ("user", "property", "end_time", "interval")
|
unique_together = ("user", "property", "subgroup", "end_time", "interval")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extended_id():
|
def extended_id():
|
||||||
|
@ -136,7 +136,7 @@ class StreamCount(BaseCount):
|
||||||
realm = models.ForeignKey(Realm)
|
realm = models.ForeignKey(Realm)
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
unique_together = ("stream", "property", "end_time", "interval")
|
unique_together = ("stream", "property", "subgroup", "end_time", "interval")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def extended_id():
|
def extended_id():
|
||||||
|
|
Loading…
Reference in New Issue