Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
migrations: Remove RunPython block from initial migration.
Tim Abbott5188cf3d8e35
diff --git a/zerver/migrations/0001_initial.py b/zerver/migrations/0001_initial.pyindex c5145b64b36..8026ac428fe 100644--- a/zerver/migrations/0001_initial.py+++ b/zerver/migrations/0001_initial.py@@ -8,33 +8,11 @@ from django.conf import settingsfrom django.contrib.postgres.indexes import GinIndexfrom django.contrib.postgres.search import SearchVectorFieldfrom django.db import migrations, models-from django.db.backends.base.schema import BaseDatabaseSchemaEditor-from django.db.migrations.state import StateAppsfrom django.db.models.functions import Upperfrom zerver.models.streams import generate_email_token_for_stream-def migrate_existing_attachment_data(- apps: StateApps, schema_editor: BaseDatabaseSchemaEditor-) -> None:- Attachment = apps.get_model("zerver", "Attachment")- Recipient = apps.get_model("zerver", "Recipient")- Stream = apps.get_model("zerver", "Stream")-- attachments = Attachment.objects.all()- for entry in attachments:- owner = entry.owner- entry.realm = owner.realm- for message in entry.messages.all():- if owner == message.sender and message.recipient.type == Recipient.STREAM:- stream = Stream.objects.get(id=message.recipient.type_id)- is_realm_public = not stream.realm.is_zephyr_mirror_realm and not stream.invite_only- entry.is_realm_public = entry.is_realm_public or is_realm_public-- entry.save()--class Migration(migrations.Migration):initial = True@@ -896,10 +874,6 @@ CREATE TRIGGER zerver_message_update_search_tsvector_asyncto="zerver.Realm",),),- migrations.RunPython(- code=migrate_existing_attachment_data,- elidable=True,- ),migrations.AddField(model_name="subscription",name="pin_to_top",