mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
This is a preparatory commit for using isort for sorting all of our imports, merging changes to files where we can easily review the changes as something we're happy with. These are also files with relatively little active development, which means we don't expect much merge conflict risk from these changes.
30 lines
1.1 KiB
Python
30 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
from django.db import migrations
|
|
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
def delete_messages_sent_to_stream_stat(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
|
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()
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('analytics', '0008_add_count_indexes'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(delete_messages_sent_to_stream_stat),
|
|
]
|