2017-02-15 04:10:03 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
2017-11-16 00:55:49 +01:00
|
|
|
from django.db import migrations
|
2017-02-15 04:10:03 +01:00
|
|
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
|
|
def delete_messages_sent_to_stream_stat(apps, schema_editor):
|
|
|
|
# type: (StateApps, DatabaseSchemaEditor) -> None
|
2017-03-12 08:02:10 +01:00
|
|
|
UserCount = apps.get_model('analytics', 'UserCount')
|
|
|
|
StreamCount = apps.get_model('analytics', 'StreamCount')
|
|
|
|
RealmCount = apps.get_model('analytics', 'RealmCount')
|
|
|
|
InstallationCount = apps.get_model('analytics', 'InstallationCount')
|
|
|
|
FillState = apps.get_model('analytics', 'FillState')
|
|
|
|
|
|
|
|
property = 'messages_sent_to_stream:is_bot'
|
|
|
|
UserCount.objects.filter(property=property).delete()
|
|
|
|
StreamCount.objects.filter(property=property).delete()
|
|
|
|
RealmCount.objects.filter(property=property).delete()
|
|
|
|
InstallationCount.objects.filter(property=property).delete()
|
|
|
|
FillState.objects.filter(property=property).delete()
|
2017-02-15 04:10:03 +01:00
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('analytics', '0008_add_count_indexes'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.RunPython(delete_messages_sent_to_stream_stat),
|
|
|
|
]
|