migration: Add migration to remove default status of private streams.

This commit adds migration which removes default status of exisitng
default private streams, i.e. private stream exists but they are no
longer default.
This commit is contained in:
sahil839 2020-08-11 01:56:06 +05:30 committed by Tim Abbott
parent 8d783e9d46
commit 7106069d4d
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Generated by Django 2.2.14 on 2020-08-10 20:21
from django.db import migrations
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
def remove_default_status_of_default_private_streams(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
DefaultStream = apps.get_model('zerver', 'DefaultStream')
DefaultStream.objects.filter(stream__invite_only=True).delete()
class Migration(migrations.Migration):
dependencies = [
('zerver', '0303_realm_wildcard_mention_policy'),
]
operations = [
migrations.RunPython(remove_default_status_of_default_private_streams,
reverse_code=migrations.RunPython.noop,
elidable=True),
]