2019-04-08 19:23:00 +02:00
|
|
|
# Generated by Django 1.11.20 on 2019-04-29 05:29
|
|
|
|
|
|
|
|
from django.db import migrations, models
|
2020-04-27 07:19:08 +02:00
|
|
|
from django.db.backends.postgresql.schema import DatabaseSchemaEditor
|
2019-04-08 19:23:00 +02:00
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2020-02-17 17:13:57 +01:00
|
|
|
INVITE_TO_STREAM_POLICY_MEMBERS = 1
|
2019-04-08 19:23:00 +02:00
|
|
|
def handle_waiting_period(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None:
|
|
|
|
Realm = apps.get_model('zerver', 'Realm')
|
2020-02-17 17:13:57 +01:00
|
|
|
Realm.INVITE_TO_STREAM_POLICY_WAITING_PERIOD = 3
|
2019-04-08 19:23:00 +02:00
|
|
|
Realm.objects.filter(waiting_period_threshold__gt=0).update(
|
2020-02-17 17:13:57 +01:00
|
|
|
invite_to_stream_policy=Realm.INVITE_TO_STREAM_POLICY_WAITING_PERIOD)
|
2019-04-08 19:23:00 +02:00
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
|
|
|
|
dependencies = [
|
|
|
|
('zerver', '0213_realm_digest_weekday'),
|
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.AddField(
|
|
|
|
model_name='realm',
|
|
|
|
name='invite_to_stream_policy',
|
2020-02-17 17:13:57 +01:00
|
|
|
field=models.PositiveSmallIntegerField(default=INVITE_TO_STREAM_POLICY_MEMBERS),
|
2019-04-08 19:23:00 +02:00
|
|
|
),
|
|
|
|
migrations.RunPython(handle_waiting_period,
|
2020-04-29 08:43:25 +02:00
|
|
|
reverse_code=migrations.RunPython.noop,
|
|
|
|
elidable=True),
|
2019-04-08 19:23:00 +02:00
|
|
|
]
|