mirror of https://github.com/zulip/zulip.git
bots: Change bot_type to DEFAULT_BOT for bots with None bot_type
Fixes #5440
This commit is contained in:
parent
d2b3a52812
commit
c36c3ae20b
|
@ -0,0 +1,25 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.2 on 2017-06-20 10:31
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
|
||||
from django.db.migrations.state import StateApps
|
||||
|
||||
def fix_bot_type(apps, schema_editor):
|
||||
# type: (StateApps, DatabaseSchemaEditor) -> None
|
||||
UserProfile = apps.get_model("zerver", "UserProfile")
|
||||
bots = UserProfile.objects.filter(is_bot=True, bot_type=None)
|
||||
for bot in bots:
|
||||
bot.bot_type = 1
|
||||
bot.save()
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('zerver', '0084_realmemoji_deactivated'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(fix_bot_type),
|
||||
]
|
Loading…
Reference in New Issue