2020-02-04 21:50:55 +01:00
|
|
|
# Generated by Django 1.11.26 on 2020-01-25 23:47
|
|
|
|
|
|
|
|
from django.db import migrations
|
2023-03-04 01:40:40 +01:00
|
|
|
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
|
2020-02-04 21:50:55 +01:00
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
|
|
|
|
2022-05-27 23:33:51 +02:00
|
|
|
def upgrade_stream_post_policy(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None:
|
2021-02-12 08:20:45 +01:00
|
|
|
Stream = apps.get_model("zerver", "Stream")
|
2020-02-17 17:13:57 +01:00
|
|
|
Stream.STREAM_POST_POLICY_EVERYONE = 1
|
|
|
|
Stream.STREAM_POST_POLICY_ADMINS = 2
|
2021-02-12 08:19:30 +01:00
|
|
|
Stream.objects.filter(is_announcement_only=False).update(
|
|
|
|
stream_post_policy=Stream.STREAM_POST_POLICY_EVERYONE
|
|
|
|
)
|
|
|
|
Stream.objects.filter(is_announcement_only=True).update(
|
|
|
|
stream_post_policy=Stream.STREAM_POST_POLICY_ADMINS
|
|
|
|
)
|
|
|
|
|
2020-02-04 21:50:55 +01:00
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
2021-02-12 08:20:45 +01:00
|
|
|
("zerver", "0263_stream_stream_post_policy"),
|
2020-02-04 21:50:55 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
2021-02-12 08:19:30 +01:00
|
|
|
migrations.RunPython(
|
|
|
|
upgrade_stream_post_policy, reverse_code=migrations.RunPython.noop, elidable=True
|
|
|
|
),
|
2020-02-04 21:50:55 +01:00
|
|
|
]
|