2018-04-03 03:55:51 +02:00
|
|
|
# Generated by Django 1.11.6 on 2018-04-03 01:52
|
|
|
|
|
|
|
|
from django.db import migrations
|
2022-05-27 23:33:51 +02:00
|
|
|
from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor
|
2018-04-03 03:55:51 +02:00
|
|
|
from django.db.migrations.state import StateApps
|
|
|
|
|
2020-01-14 21:59:46 +01:00
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
def migrate_fix_invalid_bot_owner_values(
|
2022-05-27 23:33:51 +02:00
|
|
|
apps: StateApps, schema_editor: BaseDatabaseSchemaEditor
|
2021-02-12 08:19:30 +01:00
|
|
|
) -> None:
|
2018-04-03 03:55:51 +02:00
|
|
|
"""Fixes UserProfile objects that incorrectly had a bot_owner set"""
|
2021-02-12 08:20:45 +01:00
|
|
|
UserProfile = apps.get_model("zerver", "UserProfile")
|
2018-04-03 03:55:51 +02:00
|
|
|
UserProfile.objects.filter(is_bot=False).exclude(bot_owner=None).update(bot_owner=None)
|
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
|
2018-04-03 03:55:51 +02:00
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
2021-02-12 08:20:45 +01:00
|
|
|
("zerver", "0153_remove_int_float_custom_fields"),
|
2018-04-03 03:55:51 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.RunPython(
|
|
|
|
migrate_fix_invalid_bot_owner_values,
|
2020-04-29 08:43:25 +02:00
|
|
|
reverse_code=migrations.RunPython.noop,
|
2021-02-12 08:19:30 +01:00
|
|
|
elidable=True,
|
|
|
|
),
|
2018-04-03 03:55:51 +02:00
|
|
|
]
|