diff --git a/analytics/migrations/0009_remove_messages_to_stream_stat.py b/analytics/migrations/0009_remove_messages_to_stream_stat.py index 8f3ff9b08d..9d8376c3f0 100644 --- a/analytics/migrations/0009_remove_messages_to_stream_stat.py +++ b/analytics/migrations/0009_remove_messages_to_stream_stat.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def delete_messages_sent_to_stream_stat( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: UserCount = apps.get_model("analytics", "UserCount") StreamCount = apps.get_model("analytics", "StreamCount") diff --git a/analytics/migrations/0010_clear_messages_sent_values.py b/analytics/migrations/0010_clear_messages_sent_values.py index 5e690f01ad..5f6ff8c968 100644 --- a/analytics/migrations/0010_clear_messages_sent_values.py +++ b/analytics/migrations/0010_clear_messages_sent_values.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def clear_message_sent_by_message_type_values( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: UserCount = apps.get_model("analytics", "UserCount") StreamCount = apps.get_model("analytics", "StreamCount") diff --git a/analytics/migrations/0011_clear_analytics_tables.py b/analytics/migrations/0011_clear_analytics_tables.py index 715d3c56ad..46bfa0d128 100644 --- a/analytics/migrations/0011_clear_analytics_tables.py +++ b/analytics/migrations/0011_clear_analytics_tables.py @@ -1,9 +1,9 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def clear_analytics_tables(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def clear_analytics_tables(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserCount = apps.get_model("analytics", "UserCount") StreamCount = apps.get_model("analytics", "StreamCount") RealmCount = apps.get_model("analytics", "RealmCount") diff --git a/analytics/migrations/0015_clear_duplicate_counts.py b/analytics/migrations/0015_clear_duplicate_counts.py index c82e468439..de50e1cfe7 100644 --- a/analytics/migrations/0015_clear_duplicate_counts.py +++ b/analytics/migrations/0015_clear_duplicate_counts.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Count, Sum -def clear_duplicate_counts(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def clear_duplicate_counts(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """This is a preparatory migration for our Analytics tables. The backstory is that Django's unique_together indexes do not properly diff --git a/confirmation/migrations/0009_confirmation_expiry_date_backfill.py b/confirmation/migrations/0009_confirmation_expiry_date_backfill.py index a041e6091b..23304be744 100644 --- a/confirmation/migrations/0009_confirmation_expiry_date_backfill.py +++ b/confirmation/migrations/0009_confirmation_expiry_date_backfill.py @@ -5,12 +5,12 @@ from datetime import timedelta from django.conf import settings from django.db import migrations, transaction -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_expiry_date_for_existing_confirmations( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Confirmation = apps.get_model("confirmation", "Confirmation") if not Confirmation.objects.exists(): diff --git a/pgroonga/migrations/0002_html_escape_subject.py b/pgroonga/migrations/0002_html_escape_subject.py index 7115789e8e..fd9b1af819 100644 --- a/pgroonga/migrations/0002_html_escape_subject.py +++ b/pgroonga/migrations/0002_html_escape_subject.py @@ -1,12 +1,12 @@ from django.db import connection, migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from psycopg2.sql import SQL from zerver.lib.migrate import do_batch_update -def rebuild_pgroonga_index(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def rebuild_pgroonga_index(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: with connection.cursor() as cursor: do_batch_update( cursor, diff --git a/zerver/migrations/0001_initial.py b/zerver/migrations/0001_initial.py index 0a20b1029c..f71c68260a 100644 --- a/zerver/migrations/0001_initial.py +++ b/zerver/migrations/0001_initial.py @@ -8,14 +8,16 @@ from django.conf import settings from django.contrib.postgres.indexes import GinIndex from django.contrib.postgres.search import SearchVectorField from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models.functions import Upper from zerver.models import generate_email_token_for_stream -def migrate_existing_attachment_data(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +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") diff --git a/zerver/migrations/0029_realm_subdomain.py b/zerver/migrations/0029_realm_subdomain.py index 1552d60237..9f7855ca1e 100644 --- a/zerver/migrations/0029_realm_subdomain.py +++ b/zerver/migrations/0029_realm_subdomain.py @@ -1,11 +1,13 @@ from django.conf import settings from django.core.exceptions import ObjectDoesNotExist from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def set_subdomain_of_default_realm(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_subdomain_of_default_realm( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: if settings.DEVELOPMENT: Realm = apps.get_model("zerver", "Realm") try: diff --git a/zerver/migrations/0032_verify_all_medium_avatar_images.py b/zerver/migrations/0032_verify_all_medium_avatar_images.py index 92399f9a45..df10daf86c 100644 --- a/zerver/migrations/0032_verify_all_medium_avatar_images.py +++ b/zerver/migrations/0032_verify_all_medium_avatar_images.py @@ -3,7 +3,7 @@ from unittest.mock import patch from django.conf import settings from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from zerver.lib.upload import upload_backend @@ -24,7 +24,7 @@ def patched_user_avatar_path(user_profile: UserProfile) -> str: @patch("zerver.lib.upload.user_avatar_path", patched_user_avatar_path) -def verify_medium_avatar_image(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def verify_medium_avatar_image(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: user_profile_model = apps.get_model("zerver", "UserProfile") for user_profile in user_profile_model.objects.filter(avatar_source="U"): upload_backend.ensure_avatar_image(user_profile, is_medium=True) diff --git a/zerver/migrations/0033_migrate_domain_to_realmalias.py b/zerver/migrations/0033_migrate_domain_to_realmalias.py index 906755f542..d4efb1ee53 100644 --- a/zerver/migrations/0033_migrate_domain_to_realmalias.py +++ b/zerver/migrations/0033_migrate_domain_to_realmalias.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def add_domain_to_realm_alias_if_needed( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") RealmAlias = apps.get_model("zerver", "RealmAlias") diff --git a/zerver/migrations/0037_disallow_null_string_id.py b/zerver/migrations/0037_disallow_null_string_id.py index 67803dc944..ceb64a660e 100644 --- a/zerver/migrations/0037_disallow_null_string_id.py +++ b/zerver/migrations/0037_disallow_null_string_id.py @@ -1,10 +1,10 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.utils import IntegrityError -def set_string_id_using_domain(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_string_id_using_domain(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") for realm in Realm.objects.all(): if not realm.string_id: diff --git a/zerver/migrations/0041_create_attachments_for_old_messages.py b/zerver/migrations/0041_create_attachments_for_old_messages.py index bb77415b99..2d48ab0140 100644 --- a/zerver/migrations/0041_create_attachments_for_old_messages.py +++ b/zerver/migrations/0041_create_attachments_for_old_messages.py @@ -2,7 +2,7 @@ import os import re from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps attachment_url_re = re.compile(r"[/\-]user[\-_]uploads[/\.-].*?(?=[ )]|\Z)") @@ -14,7 +14,7 @@ def attachment_url_to_path_id(attachment_url: str) -> str: return re.sub("[.]+$", "", path_id_raw, re.M) -def check_and_create_attachments(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def check_and_create_attachments(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: STREAM = 2 Message = apps.get_model("zerver", "Message") Attachment = apps.get_model("zerver", "Attachment") diff --git a/zerver/migrations/0057_realmauditlog.py b/zerver/migrations/0057_realmauditlog.py index d6bc02a469..0ee5f19cf1 100644 --- a/zerver/migrations/0057_realmauditlog.py +++ b/zerver/migrations/0057_realmauditlog.py @@ -2,13 +2,13 @@ import django.db.models.deletion from django.conf import settings from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.utils.timezone import now as timezone_now def backfill_user_activations_and_deactivations( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: migration_time = timezone_now() RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") @@ -33,7 +33,7 @@ def backfill_user_activations_and_deactivations( ) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.objects.filter(event_type="user_created").delete() RealmAuditLog.objects.filter(event_type="user_deactivated").delete() diff --git a/zerver/migrations/0074_fix_duplicate_attachments.py b/zerver/migrations/0074_fix_duplicate_attachments.py index d306929e17..770a61c0fc 100644 --- a/zerver/migrations/0074_fix_duplicate_attachments.py +++ b/zerver/migrations/0074_fix_duplicate_attachments.py @@ -1,11 +1,11 @@ # Generated by Django 1.10.5 on 2017-04-13 22:12 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Count -def fix_duplicate_attachments(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_duplicate_attachments(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """Migration 0041 had a bug, where if multiple messages referenced the same attachment, rather than creating a single attachment object for all of them, we would incorrectly create one for each message. diff --git a/zerver/migrations/0079_remove_old_scheduled_jobs.py b/zerver/migrations/0079_remove_old_scheduled_jobs.py index f341ecd61a..91c0dfce3b 100644 --- a/zerver/migrations/0079_remove_old_scheduled_jobs.py +++ b/zerver/migrations/0079_remove_old_scheduled_jobs.py @@ -1,10 +1,10 @@ # Generated by Django 1.10.5 on 2017-05-10 05:59 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def delete_old_scheduled_jobs(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def delete_old_scheduled_jobs(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """Delete any old scheduled jobs, to handle changes in the format of that table. Ideally, we'd translate the jobs, but it's not really worth the development effort to save a few invitation reminders diff --git a/zerver/migrations/0081_make_emoji_lowercase.py b/zerver/migrations/0081_make_emoji_lowercase.py index 350bbefc0d..0d5532178a 100644 --- a/zerver/migrations/0081_make_emoji_lowercase.py +++ b/zerver/migrations/0081_make_emoji_lowercase.py @@ -1,7 +1,7 @@ # Generated by Django 1.10.5 on 2017-05-02 21:44 import django.core.validators from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps @@ -11,7 +11,7 @@ class Migration(migrations.Migration): ("zerver", "0080_realm_description_length"), ] - def emoji_to_lowercase(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: + def emoji_to_lowercase(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmEmoji = apps.get_model("zerver", "RealmEmoji") emoji = RealmEmoji.objects.all() for e in emoji: diff --git a/zerver/migrations/0085_fix_bots_with_none_bot_type.py b/zerver/migrations/0085_fix_bots_with_none_bot_type.py index 950515804b..fbc42c3105 100644 --- a/zerver/migrations/0085_fix_bots_with_none_bot_type.py +++ b/zerver/migrations/0085_fix_bots_with_none_bot_type.py @@ -1,10 +1,10 @@ # Generated by Django 1.11.2 on 2017-06-20 10:31 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def fix_bot_type(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_bot_type(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") bots = UserProfile.objects.filter(is_bot=True, bot_type=None) for bot in bots: diff --git a/zerver/migrations/0087_remove_old_scheduled_jobs.py b/zerver/migrations/0087_remove_old_scheduled_jobs.py index c4517de70f..bf9a27592c 100644 --- a/zerver/migrations/0087_remove_old_scheduled_jobs.py +++ b/zerver/migrations/0087_remove_old_scheduled_jobs.py @@ -1,10 +1,10 @@ # Generated by Django 1.10.5 on 2017-05-10 05:59 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def delete_old_scheduled_jobs(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def delete_old_scheduled_jobs(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """Delete any old scheduled jobs, to handle changes in the format of send_email. Ideally, we'd translate the jobs, but it's not really worth the development effort to save a few invitation reminders diff --git a/zerver/migrations/0093_subscription_event_log_backfill.py b/zerver/migrations/0093_subscription_event_log_backfill.py index 6c5b058213..0a9c40236d 100644 --- a/zerver/migrations/0093_subscription_event_log_backfill.py +++ b/zerver/migrations/0093_subscription_event_log_backfill.py @@ -1,11 +1,13 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Max from django.utils.timezone import now as timezone_now -def backfill_subscription_log_events(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_subscription_log_events( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: migration_time = timezone_now() RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") Subscription = apps.get_model("zerver", "Subscription") @@ -46,7 +48,7 @@ def backfill_subscription_log_events(apps: StateApps, schema_editor: DatabaseSch objects_to_create = [] -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.objects.filter(event_type="subscription_created").delete() RealmAuditLog.objects.filter(event_type="subscription_deactivated").delete() diff --git a/zerver/migrations/0097_reactions_emoji_code.py b/zerver/migrations/0097_reactions_emoji_code.py index a0d3225dbc..025e44e8ea 100644 --- a/zerver/migrations/0097_reactions_emoji_code.py +++ b/zerver/migrations/0097_reactions_emoji_code.py @@ -3,11 +3,11 @@ import os import orjson from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def populate_new_fields(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def populate_new_fields(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: # Open the JSON file which contains the data to be used for migration. MIGRATION_DATA_PATH = os.path.join( os.path.dirname(os.path.dirname(__file__)), "management", "data" diff --git a/zerver/migrations/0102_convert_muted_topic.py b/zerver/migrations/0102_convert_muted_topic.py index 75a5d11b42..882ecbf0f0 100644 --- a/zerver/migrations/0102_convert_muted_topic.py +++ b/zerver/migrations/0102_convert_muted_topic.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.4 on 2017-08-30 00:26 import orjson from django.db import connection, migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from psycopg2.sql import SQL -def convert_muted_topics(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def convert_muted_topics(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: stream_query = SQL( """ SELECT diff --git a/zerver/migrations/0104_fix_unreads.py b/zerver/migrations/0104_fix_unreads.py index c74d1658f0..e9258a27dd 100644 --- a/zerver/migrations/0104_fix_unreads.py +++ b/zerver/migrations/0104_fix_unreads.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.4 on 2017-08-30 00:26 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from zerver.lib.fix_unreads import fix -def fix_unreads(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_unreads(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") user_profiles = list(UserProfile.objects.filter(is_bot=False)) for user_profile in user_profiles: diff --git a/zerver/migrations/0108_fix_default_string_id.py b/zerver/migrations/0108_fix_default_string_id.py index 15f92876ac..cdc7068854 100644 --- a/zerver/migrations/0108_fix_default_string_id.py +++ b/zerver/migrations/0108_fix_default_string_id.py @@ -1,10 +1,10 @@ # Generated by Django 1.11.4 on 2017-08-24 02:39 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def fix_realm_string_ids(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_realm_string_ids(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") if Realm.objects.filter(deactivated=False).count() != 2: return diff --git a/zerver/migrations/0109_mark_tutorial_status_finished.py b/zerver/migrations/0109_mark_tutorial_status_finished.py index c4e26b026e..6dbaf3331d 100644 --- a/zerver/migrations/0109_mark_tutorial_status_finished.py +++ b/zerver/migrations/0109_mark_tutorial_status_finished.py @@ -1,9 +1,11 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def set_tutorial_status_to_finished(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_tutorial_status_to_finished( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.update(tutorial_status="F") diff --git a/zerver/migrations/0110_stream_is_in_zephyr_realm.py b/zerver/migrations/0110_stream_is_in_zephyr_realm.py index 20fa71c2ea..99886b681b 100644 --- a/zerver/migrations/0110_stream_is_in_zephyr_realm.py +++ b/zerver/migrations/0110_stream_is_in_zephyr_realm.py @@ -1,10 +1,10 @@ # Generated by Django 1.11.5 on 2017-10-08 18:37 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def populate_is_zephyr(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def populate_is_zephyr(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Stream = apps.get_model("zerver", "Stream") diff --git a/zerver/migrations/0121_realm_signup_notifications_stream.py b/zerver/migrations/0121_realm_signup_notifications_stream.py index be5326bc72..1cfa5b54e3 100644 --- a/zerver/migrations/0121_realm_signup_notifications_stream.py +++ b/zerver/migrations/0121_realm_signup_notifications_stream.py @@ -2,12 +2,12 @@ import django.db.models.deletion from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_initial_value_for_signup_notifications_stream( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: realm_model = apps.get_model("zerver", "Realm") realms = realm_model.objects.exclude(notifications_stream__isnull=True) diff --git a/zerver/migrations/0126_prereg_remove_users_without_realm.py b/zerver/migrations/0126_prereg_remove_users_without_realm.py index 1e688c4b04..f044a0bb2a 100644 --- a/zerver/migrations/0126_prereg_remove_users_without_realm.py +++ b/zerver/migrations/0126_prereg_remove_users_without_realm.py @@ -1,11 +1,13 @@ # Generated by Django 1.11.6 on 2017-11-30 04:58 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def remove_prereg_users_without_realm(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def remove_prereg_users_without_realm( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: prereg_model = apps.get_model("zerver", "PreregistrationUser") prereg_model.objects.filter(realm=None, realm_creation=False).delete() diff --git a/zerver/migrations/0128_scheduledemail_realm.py b/zerver/migrations/0128_scheduledemail_realm.py index 98dcb702bc..5ec2df151d 100644 --- a/zerver/migrations/0128_scheduledemail_realm.py +++ b/zerver/migrations/0128_scheduledemail_realm.py @@ -2,12 +2,12 @@ import django.db.models.deletion from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_realm_for_existing_scheduledemails( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: scheduledemail_model = apps.get_model("zerver", "ScheduledEmail") preregistrationuser_model = apps.get_model("zerver", "PreregistrationUser") diff --git a/zerver/migrations/0130_text_choice_in_emojiset.py b/zerver/migrations/0130_text_choice_in_emojiset.py index 3010c2aa76..d0a85b43f9 100644 --- a/zerver/migrations/0130_text_choice_in_emojiset.py +++ b/zerver/migrations/0130_text_choice_in_emojiset.py @@ -1,17 +1,17 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # change emoji set to text if emoji_alt_code is true. -def change_emojiset(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def change_emojiset(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") for user in UserProfile.objects.filter(emoji_alt_code=True): user.emojiset = "text" user.save(update_fields=["emojiset"]) -def reverse_change_emojiset(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_change_emojiset(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") for user in UserProfile.objects.filter(emojiset="text"): # Resetting `emojiset` to "google" (the default) doesn't make an diff --git a/zerver/migrations/0139_fill_last_message_id_in_subscription_logs.py b/zerver/migrations/0139_fill_last_message_id_in_subscription_logs.py index 5d0b24fb4f..2feb0eb203 100644 --- a/zerver/migrations/0139_fill_last_message_id_in_subscription_logs.py +++ b/zerver/migrations/0139_fill_last_message_id_in_subscription_logs.py @@ -1,9 +1,9 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def backfill_last_message_id(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_last_message_id(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: event_type = ["subscription_created", "subscription_deactivated", "subscription_activated"] RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") subscription_logs = RealmAuditLog.objects.filter( diff --git a/zerver/migrations/0143_realm_bot_creation_policy.py b/zerver/migrations/0143_realm_bot_creation_policy.py index 0591fe6611..6c95f448eb 100644 --- a/zerver/migrations/0143_realm_bot_creation_policy.py +++ b/zerver/migrations/0143_realm_bot_creation_policy.py @@ -1,13 +1,13 @@ # Generated by Django 1.11.6 on 2018-03-09 18:00 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps BOT_CREATION_EVERYONE = 1 def set_initial_value_for_bot_creation_policy( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.BOT_CREATION_EVERYONE = 1 @@ -20,7 +20,7 @@ def set_initial_value_for_bot_creation_policy( realm.save(update_fields=["bot_creation_policy"]) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.BOT_CREATION_EVERYONE = 1 for realm in Realm.objects.all(): diff --git a/zerver/migrations/0145_reactions_realm_emoji_name_to_id.py b/zerver/migrations/0145_reactions_realm_emoji_name_to_id.py index 785cfcd681..b7d08f7c26 100644 --- a/zerver/migrations/0145_reactions_realm_emoji_name_to_id.py +++ b/zerver/migrations/0145_reactions_realm_emoji_name_to_id.py @@ -2,11 +2,11 @@ from collections import defaultdict from typing import Any, Dict from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def realm_emoji_name_to_id(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def realm_emoji_name_to_id(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Reaction = apps.get_model("zerver", "Reaction") RealmEmoji = apps.get_model("zerver", "RealmEmoji") realm_emoji_by_realm_id: Dict[int, Dict[str, Any]] = defaultdict(dict) @@ -33,7 +33,7 @@ def realm_emoji_name_to_id(apps: StateApps, schema_editor: DatabaseSchemaEditor) reaction.save() -def reversal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reversal(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Reaction = apps.get_model("zerver", "Reaction") for reaction in Reaction.objects.filter(reaction_type="realm_emoji"): reaction.emoji_code = reaction.emoji_name diff --git a/zerver/migrations/0149_realm_emoji_drop_unique_constraint.py b/zerver/migrations/0149_realm_emoji_drop_unique_constraint.py index 6dd8c8b83b..e312b49489 100644 --- a/zerver/migrations/0149_realm_emoji_drop_unique_constraint.py +++ b/zerver/migrations/0149_realm_emoji_drop_unique_constraint.py @@ -4,7 +4,7 @@ import shutil import boto3 from django.conf import settings from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from mypy_boto3_s3.type_defs import CopySourceTypeDef @@ -82,7 +82,9 @@ def get_emoji_file_name(emoji_file_name: str, new_name: str) -> str: return "".join((new_name, image_ext)) -def migrate_realm_emoji_image_files(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def migrate_realm_emoji_image_files( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: RealmEmoji = apps.get_model("zerver", "RealmEmoji") uploader = get_uploader() for realm_emoji in RealmEmoji.objects.all(): @@ -93,7 +95,7 @@ def migrate_realm_emoji_image_files(apps: StateApps, schema_editor: DatabaseSche realm_emoji.save(update_fields=["file_name"]) -def reversal(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reversal(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: # Ensures that migration can be re-run in case of a failure. RealmEmoji = apps.get_model("zerver", "RealmEmoji") for realm_emoji in RealmEmoji.objects.all(): diff --git a/zerver/migrations/0154_fix_invalid_bot_owner.py b/zerver/migrations/0154_fix_invalid_bot_owner.py index 4368f61d2a..1657d4df7d 100644 --- a/zerver/migrations/0154_fix_invalid_bot_owner.py +++ b/zerver/migrations/0154_fix_invalid_bot_owner.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.6 on 2018-04-03 01:52 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def migrate_fix_invalid_bot_owner_values( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: """Fixes UserProfile objects that incorrectly had a bot_owner set""" UserProfile = apps.get_model("zerver", "UserProfile") diff --git a/zerver/migrations/0164_stream_history_public_to_subscribers.py b/zerver/migrations/0164_stream_history_public_to_subscribers.py index e0895af361..4f5d31fcc0 100644 --- a/zerver/migrations/0164_stream_history_public_to_subscribers.py +++ b/zerver/migrations/0164_stream_history_public_to_subscribers.py @@ -2,12 +2,12 @@ from django.conf import settings from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_initial_value_for_history_public_to_subscribers( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: stream_model = apps.get_model("zerver", "Stream") streams = stream_model.objects.all() diff --git a/zerver/migrations/0167_custom_profile_fields_sort_order.py b/zerver/migrations/0167_custom_profile_fields_sort_order.py index cf04db7ea7..20f5f10183 100644 --- a/zerver/migrations/0167_custom_profile_fields_sort_order.py +++ b/zerver/migrations/0167_custom_profile_fields_sort_order.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.11 on 2018-04-08 15:49 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F -def migrate_set_order_value(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def migrate_set_order_value(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: CustomProfileField = apps.get_model("zerver", "CustomProfileField") CustomProfileField.objects.all().update(order=F("id")) diff --git a/zerver/migrations/0174_userprofile_delivery_email.py b/zerver/migrations/0174_userprofile_delivery_email.py index 5c2de4c6c3..970bee6fbf 100644 --- a/zerver/migrations/0174_userprofile_delivery_email.py +++ b/zerver/migrations/0174_userprofile_delivery_email.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.13 on 2018-07-05 17:57 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F -def copy_email_field(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def copy_email_field(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.all().update(delivery_email=F("email")) diff --git a/zerver/migrations/0175_change_realm_audit_log_event_type_tense.py b/zerver/migrations/0175_change_realm_audit_log_event_type_tense.py index 7c65e8ac8a..1433f1f91e 100644 --- a/zerver/migrations/0175_change_realm_audit_log_event_type_tense.py +++ b/zerver/migrations/0175_change_realm_audit_log_event_type_tense.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def change_realm_audit_log_event_type_tense( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.objects.filter(event_type="user_change_password").update( diff --git a/zerver/migrations/0177_user_message_add_and_index_is_private_flag.py b/zerver/migrations/0177_user_message_add_and_index_is_private_flag.py index 354fa03429..6ed6c07bed 100644 --- a/zerver/migrations/0177_user_message_add_and_index_is_private_flag.py +++ b/zerver/migrations/0177_user_message_add_and_index_is_private_flag.py @@ -2,12 +2,12 @@ import bitfield.models from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F, Q -def reset_is_private_flag(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reset_is_private_flag(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserMessage = apps.get_model("zerver", "UserMessage") UserProfile = apps.get_model("zerver", "UserProfile") user_profile_ids = UserProfile.objects.all().order_by("id").values_list("id", flat=True) diff --git a/zerver/migrations/0181_userprofile_change_emojiset.py b/zerver/migrations/0181_userprofile_change_emojiset.py index 9f72b7a649..04b76188fa 100644 --- a/zerver/migrations/0181_userprofile_change_emojiset.py +++ b/zerver/migrations/0181_userprofile_change_emojiset.py @@ -1,9 +1,9 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def change_emojiset_choice(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def change_emojiset_choice(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.exclude(emojiset__in=["google", "text"]).update(emojiset="google") diff --git a/zerver/migrations/0182_set_initial_value_is_private_flag.py b/zerver/migrations/0182_set_initial_value_is_private_flag.py index c3998f56b2..5d5377d121 100644 --- a/zerver/migrations/0182_set_initial_value_is_private_flag.py +++ b/zerver/migrations/0182_set_initial_value_is_private_flag.py @@ -1,11 +1,11 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F def set_initial_value_of_is_private_flag( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: UserMessage = apps.get_model("zerver", "UserMessage") Message = apps.get_model("zerver", "Message") diff --git a/zerver/migrations/0189_userprofile_add_some_emojisets.py b/zerver/migrations/0189_userprofile_add_some_emojisets.py index db161787ca..1180a1aa6e 100644 --- a/zerver/migrations/0189_userprofile_add_some_emojisets.py +++ b/zerver/migrations/0189_userprofile_add_some_emojisets.py @@ -1,11 +1,11 @@ # Generated by Django 1.11.14 on 2018-08-28 19:01 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def change_emojiset_choice(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def change_emojiset_choice(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.filter(emojiset="google").update(emojiset="google-blob") diff --git a/zerver/migrations/0198_preregistrationuser_invited_as.py b/zerver/migrations/0198_preregistrationuser_invited_as.py index 6e955b7063..80b46d2442 100644 --- a/zerver/migrations/0198_preregistrationuser_invited_as.py +++ b/zerver/migrations/0198_preregistrationuser_invited_as.py @@ -1,11 +1,13 @@ # Generated by Django 1.11.16 on 2018-12-27 17:09 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def set_initial_value_for_invited_as(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_initial_value_for_invited_as( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: PreregistrationUser = apps.get_model("zerver", "PreregistrationUser") for user in PreregistrationUser.objects.all(): if user.invited_as_admin: @@ -15,7 +17,7 @@ def set_initial_value_for_invited_as(apps: StateApps, schema_editor: DatabaseSch user.save(update_fields=["invited_as"]) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: PreregistrationUser = apps.get_model("zerver", "PreregistrationUser") for user in PreregistrationUser.objects.all(): if user.invited_as == 2: # PreregistrationUser.INVITE_AS['REALM_ADMIN'] diff --git a/zerver/migrations/0206_stream_rendered_description.py b/zerver/migrations/0206_stream_rendered_description.py index 38f58e43b6..b69b5d5469 100644 --- a/zerver/migrations/0206_stream_rendered_description.py +++ b/zerver/migrations/0206_stream_rendered_description.py @@ -1,9 +1,11 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def render_all_stream_descriptions(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def render_all_stream_descriptions( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: # FIXME: Application code should not be imported from migrations. from zerver.lib.streams import render_stream_description diff --git a/zerver/migrations/0209_user_profile_no_empty_password.py b/zerver/migrations/0209_user_profile_no_empty_password.py index 40d98b22c5..053ad36025 100644 --- a/zerver/migrations/0209_user_profile_no_empty_password.py +++ b/zerver/migrations/0209_user_profile_no_empty_password.py @@ -6,7 +6,7 @@ import orjson from django.conf import settings from django.contrib.auth.hashers import check_password, make_password from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.utils.timezone import now as timezone_now @@ -15,7 +15,7 @@ from zerver.lib.queue import queue_json_publish from zerver.lib.utils import generate_api_key -def ensure_no_empty_passwords(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def ensure_no_empty_passwords(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """With CVE-2019-18933, it was possible for certain users created using social login (e.g. Google/GitHub auth) to have the empty string as their password in the Zulip database, rather than diff --git a/zerver/migrations/0210_stream_first_message_id.py b/zerver/migrations/0210_stream_first_message_id.py index f1989bb5fd..61ec59b8ec 100644 --- a/zerver/migrations/0210_stream_first_message_id.py +++ b/zerver/migrations/0210_stream_first_message_id.py @@ -1,11 +1,11 @@ # Generated by Django 1.11.18 on 2019-02-25 12:42 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def backfill_first_message_id(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_first_message_id(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Stream = apps.get_model("zerver", "Stream") Message = apps.get_model("zerver", "Message") for stream in Stream.objects.all(): diff --git a/zerver/migrations/0211_add_users_field_to_scheduled_email.py b/zerver/migrations/0211_add_users_field_to_scheduled_email.py index b57b194ee0..8b390eddbb 100644 --- a/zerver/migrations/0211_add_users_field_to_scheduled_email.py +++ b/zerver/migrations/0211_add_users_field_to_scheduled_email.py @@ -2,12 +2,12 @@ from django.conf import settings from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def set_users_for_existing_scheduledemails( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: ScheduledEmail = apps.get_model("zerver", "ScheduledEmail") for email in ScheduledEmail.objects.all(): diff --git a/zerver/migrations/0214_realm_invite_to_stream_policy.py b/zerver/migrations/0214_realm_invite_to_stream_policy.py index fb472f8a55..463233a4c4 100644 --- a/zerver/migrations/0214_realm_invite_to_stream_policy.py +++ b/zerver/migrations/0214_realm_invite_to_stream_policy.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.20 on 2019-04-29 05:29 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps INVITE_TO_STREAM_POLICY_MEMBERS = 1 -def handle_waiting_period(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def handle_waiting_period(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.INVITE_TO_STREAM_POLICY_WAITING_PERIOD = 3 Realm.objects.filter(waiting_period_threshold__gt=0).update( diff --git a/zerver/migrations/0217_migrate_create_stream_policy.py b/zerver/migrations/0217_migrate_create_stream_policy.py index 36a99710c5..56738b43f3 100644 --- a/zerver/migrations/0217_migrate_create_stream_policy.py +++ b/zerver/migrations/0217_migrate_create_stream_policy.py @@ -1,11 +1,11 @@ # Generated by Django 1.11.20 on 2019-05-06 13:15 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def upgrade_create_stream_policy(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def upgrade_create_stream_policy(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.CREATE_STREAM_POLICY_MEMBERS = 1 Realm.CREATE_STREAM_POLICY_ADMINS = 2 diff --git a/zerver/migrations/0219_toggle_realm_digest_emails_enabled_default.py b/zerver/migrations/0219_toggle_realm_digest_emails_enabled_default.py index a3af8850d8..ee426cf0e0 100644 --- a/zerver/migrations/0219_toggle_realm_digest_emails_enabled_default.py +++ b/zerver/migrations/0219_toggle_realm_digest_emails_enabled_default.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.20 on 2019-05-08 05:42 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def disable_realm_digest_emails_enabled( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") realms = Realm.objects.filter(digest_emails_enabled=True) diff --git a/zerver/migrations/0221_subscription_notifications_data_migration.py b/zerver/migrations/0221_subscription_notifications_data_migration.py index 7c9acbcd5f..dafc5290fc 100644 --- a/zerver/migrations/0221_subscription_notifications_data_migration.py +++ b/zerver/migrations/0221_subscription_notifications_data_migration.py @@ -1,7 +1,7 @@ # Generated by Django 1.11.18 on 2019-02-13 20:13 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps RECIPIENT_STREAM = 2 @@ -13,7 +13,7 @@ SETTINGS_MAP = { } -def update_notification_settings(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def update_notification_settings(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Subscription = apps.get_model("zerver", "Subscription") UserProfile = apps.get_model("zerver", "UserProfile") @@ -29,7 +29,7 @@ def update_notification_settings(apps: StateApps, schema_editor: DatabaseSchemaE ).update(**update_kwargs) -def reverse_notification_settings(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_notification_settings(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Subscription = apps.get_model("zerver", "Subscription") UserProfile = apps.get_model("zerver", "UserProfile") diff --git a/zerver/migrations/0223_rename_to_is_muted.py b/zerver/migrations/0223_rename_to_is_muted.py index bb6de131fe..637df64ed7 100644 --- a/zerver/migrations/0223_rename_to_is_muted.py +++ b/zerver/migrations/0223_rename_to_is_muted.py @@ -1,12 +1,14 @@ # Generated by Django 1.11.14 on 2018-08-10 16:04 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Case, Value, When -def set_initial_value_for_is_muted(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_initial_value_for_is_muted( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: Subscription = apps.get_model("zerver", "Subscription") Subscription.objects.update( is_muted=Case( @@ -16,7 +18,7 @@ def set_initial_value_for_is_muted(apps: StateApps, schema_editor: DatabaseSchem ) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Subscription = apps.get_model("zerver", "Subscription") Subscription.objects.update( in_home_view=Case( diff --git a/zerver/migrations/0224_alter_field_realm_video_chat_provider.py b/zerver/migrations/0224_alter_field_realm_video_chat_provider.py index 68dca25046..9d168e49a8 100644 --- a/zerver/migrations/0224_alter_field_realm_video_chat_provider.py +++ b/zerver/migrations/0224_alter_field_realm_video_chat_provider.py @@ -3,7 +3,7 @@ from typing import Any, Dict, Optional from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # We include a copy of this structure as it was at the time this @@ -38,7 +38,7 @@ def get_video_chat_provider_detail( def update_existing_video_chat_provider_values( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") @@ -49,7 +49,7 @@ def update_existing_video_chat_provider_values( realm.save(update_fields=["video_chat_provider"]) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") for realm in Realm.objects.all(): diff --git a/zerver/migrations/0227_inline_url_embed_preview_default_off.py b/zerver/migrations/0227_inline_url_embed_preview_default_off.py index 16900e09fe..67dcccef29 100644 --- a/zerver/migrations/0227_inline_url_embed_preview_default_off.py +++ b/zerver/migrations/0227_inline_url_embed_preview_default_off.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.20 on 2019-05-31 02:33 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def disable_realm_inline_url_embed_preview( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") realms = Realm.objects.filter(inline_url_embed_preview=True) diff --git a/zerver/migrations/0236_remove_illegal_characters_email_full.py b/zerver/migrations/0236_remove_illegal_characters_email_full.py index 359660be31..2723563a68 100644 --- a/zerver/migrations/0236_remove_illegal_characters_email_full.py +++ b/zerver/migrations/0236_remove_illegal_characters_email_full.py @@ -3,13 +3,13 @@ from unicodedata import category from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps NAME_INVALID_CHARS = ["*", "`", "\\", ">", '"', "@"] -def remove_name_illegal_chars(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def remove_name_illegal_chars(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") for user in UserProfile.objects.all(): stripped = [] diff --git a/zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py b/zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py index 6844ca0220..0af56b7326 100644 --- a/zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py +++ b/zerver/migrations/0237_rename_zulip_realm_to_zulipinternal.py @@ -1,11 +1,11 @@ from django.conf import settings from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def rename_zulip_realm_to_zulipinternal( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: if not settings.PRODUCTION: return diff --git a/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py b/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py index 29405c4670..0cf4045c91 100644 --- a/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py +++ b/zerver/migrations/0239_usermessage_copy_id_to_bigint_id.py @@ -3,7 +3,7 @@ import time from django.db import connection, migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Min from psycopg2.sql import SQL @@ -29,7 +29,7 @@ def sql_copy_id_to_bigint_id(id_range_lower_bound: int, id_range_upper_bound: in ) -def copy_id_to_bigid(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def copy_id_to_bigid(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserMessage = apps.get_model("zerver", "UserMessage") if not UserMessage.objects.exists(): # Nothing to do diff --git a/zerver/migrations/0242_fix_bot_email_property.py b/zerver/migrations/0242_fix_bot_email_property.py index 5471372063..9262df4c40 100644 --- a/zerver/migrations/0242_fix_bot_email_property.py +++ b/zerver/migrations/0242_fix_bot_email_property.py @@ -1,11 +1,11 @@ # Generated by Django 1.11.24 on 2019-09-23 20:39 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def fix_bot_email_property(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_bot_email_property(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") for user_profile in UserProfile.objects.filter(is_bot=True): if user_profile.email != user_profile.delivery_email: diff --git a/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py b/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py index 2d97f068db..59f855eab7 100644 --- a/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py +++ b/zerver/migrations/0244_message_copy_pub_date_to_date_sent.py @@ -2,7 +2,7 @@ import time from django.contrib.postgres.operations import AddIndexConcurrently from django.db import connection, migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Min from psycopg2.sql import SQL @@ -28,7 +28,7 @@ def sql_copy_pub_date_to_date_sent(id_range_lower_bound: int, id_range_upper_bou ) -def copy_pub_date_to_date_sent(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def copy_pub_date_to_date_sent(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Message = apps.get_model("zerver", "Message") if not Message.objects.exists(): # Nothing to do diff --git a/zerver/migrations/0247_realmauditlog_event_type_to_int.py b/zerver/migrations/0247_realmauditlog_event_type_to_int.py index dcbe892b60..7bd6bca374 100644 --- a/zerver/migrations/0247_realmauditlog_event_type_to_int.py +++ b/zerver/migrations/0247_realmauditlog_event_type_to_int.py @@ -1,7 +1,7 @@ # Generated by Django 1.11.24 on 2019-10-02 16:48 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps INT_VALUE = { @@ -67,14 +67,16 @@ STR_VALUE = { } -def update_existing_event_type_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def update_existing_event_type_values( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") for log_entry in RealmAuditLog.objects.all(): log_entry.event_type_int = INT_VALUE[log_entry.event_type] log_entry.save(update_fields=["event_type_int"]) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") for log_entry in RealmAuditLog.objects.all(): log_entry.event_type = STR_VALUE[log_entry.event_type_int] diff --git a/zerver/migrations/0248_userprofile_role_start.py b/zerver/migrations/0248_userprofile_role_start.py index 680da5acaa..996d3690a6 100644 --- a/zerver/migrations/0248_userprofile_role_start.py +++ b/zerver/migrations/0248_userprofile_role_start.py @@ -1,10 +1,10 @@ # Generated by Django 1.11.24 on 2019-10-03 22:27 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def update_role(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def update_role(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") # The values at the time of this migration UserProfile.ROLE_REALM_ADMINISTRATOR = 200 @@ -20,7 +20,7 @@ def update_role(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: user.save(update_fields=["role"]) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.ROLE_REALM_ADMINISTRATOR = 200 UserProfile.ROLE_GUEST = 600 diff --git a/zerver/migrations/0257_fix_has_link_attribute.py b/zerver/migrations/0257_fix_has_link_attribute.py index fd7fdca067..253282e742 100644 --- a/zerver/migrations/0257_fix_has_link_attribute.py +++ b/zerver/migrations/0257_fix_has_link_attribute.py @@ -5,7 +5,7 @@ from typing import cast import lxml from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps BATCH_SIZE = 1000 @@ -55,7 +55,7 @@ def process_batch(apps: StateApps, id_start: int, id_end: int, last_id: int) -> message.save(update_fields=["has_link", "has_attachment", "has_image"]) -def fix_has_link(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_has_link(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Message = apps.get_model("zerver", "Message") if not Message.objects.exists(): # Nothing to do, and Message.objects.latest() will crash. diff --git a/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py b/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py index 12b5fc88eb..ba5bebb166 100644 --- a/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py +++ b/zerver/migrations/0260_missed_message_addresses_from_redis_to_db.py @@ -2,7 +2,7 @@ import secrets from django.core.exceptions import ObjectDoesNotExist from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # Imported to avoid needing to duplicate Redis-related code. @@ -14,7 +14,7 @@ def generate_missed_message_token() -> str: def move_missed_message_addresses_to_database( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: redis_client = get_redis_client() MissedMessageEmailAddress = apps.get_model("zerver", "MissedMessageEmailAddress") diff --git a/zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py b/zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py index feba0db511..4fd97107ed 100644 --- a/zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py +++ b/zerver/migrations/0261_pregistrationuser_clear_invited_as_admin.py @@ -1,12 +1,12 @@ # Generated by Django 1.11.26 on 2020-06-16 22:26 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def clear_preregistrationuser_invited_as_admin( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: """This migration fixes any PreregistrationUser objects that might have been already corrupted to have the administrator role by the diff --git a/zerver/migrations/0264_migrate_is_announcement_only.py b/zerver/migrations/0264_migrate_is_announcement_only.py index 073eb22a23..02d3485d3c 100644 --- a/zerver/migrations/0264_migrate_is_announcement_only.py +++ b/zerver/migrations/0264_migrate_is_announcement_only.py @@ -1,11 +1,11 @@ # Generated by Django 1.11.26 on 2020-01-25 23:47 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def upgrade_stream_post_policy(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def upgrade_stream_post_policy(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Stream = apps.get_model("zerver", "Stream") Stream.STREAM_POST_POLICY_EVERYONE = 1 Stream.STREAM_POST_POLICY_ADMINS = 2 diff --git a/zerver/migrations/0273_migrate_old_bot_messages.py b/zerver/migrations/0273_migrate_old_bot_messages.py index e16287b272..b148d51928 100644 --- a/zerver/migrations/0273_migrate_old_bot_messages.py +++ b/zerver/migrations/0273_migrate_old_bot_messages.py @@ -2,11 +2,11 @@ from typing import Any from django.conf import settings from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def fix_messages(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_messages(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """Conceptually, this migration cleans up the old NEW_USER_BOT and FEEDBACK_BOT UserProfile objects (their implementations were removed long ago). diff --git a/zerver/migrations/0277_migrate_alert_word.py b/zerver/migrations/0277_migrate_alert_word.py index f12a14a799..19ddc10753 100644 --- a/zerver/migrations/0277_migrate_alert_word.py +++ b/zerver/migrations/0277_migrate_alert_word.py @@ -2,11 +2,11 @@ from typing import Dict, List import orjson from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def move_to_seperate_table(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def move_to_seperate_table(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") AlertWord = apps.get_model("zerver", "AlertWord") @@ -24,7 +24,7 @@ def move_to_seperate_table(apps: StateApps, schema_editor: DatabaseSchemaEditor) ) -def move_back_to_user_profile(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def move_back_to_user_profile(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: AlertWord = apps.get_model("zerver", "AlertWord") UserProfile = apps.get_model("zerver", "UserProfile") diff --git a/zerver/migrations/0284_convert_realm_admins_to_realm_owners.py b/zerver/migrations/0284_convert_realm_admins_to_realm_owners.py index 5b70e6cabf..92388e8d85 100644 --- a/zerver/migrations/0284_convert_realm_admins_to_realm_owners.py +++ b/zerver/migrations/0284_convert_realm_admins_to_realm_owners.py @@ -3,13 +3,15 @@ from typing import Any, Dict import orjson from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Count from django.utils.timezone import now as timezone_now -def set_realm_admins_as_realm_owners(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_realm_admins_as_realm_owners( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: UserProfile = apps.get_model("zerver", "UserProfile") RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") diff --git a/zerver/migrations/0285_remove_realm_google_hangouts_domain.py b/zerver/migrations/0285_remove_realm_google_hangouts_domain.py index 481de89802..18b24d6c98 100644 --- a/zerver/migrations/0285_remove_realm_google_hangouts_domain.py +++ b/zerver/migrations/0285_remove_realm_google_hangouts_domain.py @@ -1,7 +1,7 @@ # Generated by Django 2.2.13 on 2020-06-14 01:58 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps VIDEO_CHAT_PROVIDERS = { @@ -16,7 +16,9 @@ VIDEO_CHAT_PROVIDERS = { } -def remove_google_hangouts_provider(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def remove_google_hangouts_provider( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: # We are removing the Google Hangout integration because Google has # removed the Hangouts brand. All the realms that used Hangouts as # their video chat provided are now set to the default, Jitsi. diff --git a/zerver/migrations/0287_clear_duplicate_reactions.py b/zerver/migrations/0287_clear_duplicate_reactions.py index 7ea82552dc..e99e46207b 100644 --- a/zerver/migrations/0287_clear_duplicate_reactions.py +++ b/zerver/migrations/0287_clear_duplicate_reactions.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Count -def clear_duplicate_reactions(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def clear_duplicate_reactions(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """Zulip's data model for reactions has enforced via code, nontransactionally, that they can only react with one emoji_code for a given reaction_type. This fixes any that were stored in the diff --git a/zerver/migrations/0290_remove_night_mode_add_color_scheme.py b/zerver/migrations/0290_remove_night_mode_add_color_scheme.py index 7723b3c017..2acb55650b 100644 --- a/zerver/migrations/0290_remove_night_mode_add_color_scheme.py +++ b/zerver/migrations/0290_remove_night_mode_add_color_scheme.py @@ -1,14 +1,16 @@ # Generated by Django 2.2.13 on 2020-06-20 15:22 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps COLOR_SCHEME_AUTOMATIC = 1 COLOR_SCHEME_NIGHT = 2 # Set color_scheme to night mode, if night_mode is True. -def set_color_scheme_to_night_mode(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_color_scheme_to_night_mode( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.filter(night_mode=True).update(color_scheme=COLOR_SCHEME_NIGHT) diff --git a/zerver/migrations/0293_update_invite_as_dict_values.py b/zerver/migrations/0293_update_invite_as_dict_values.py index 1d635d5d7a..d7e05a3bb6 100644 --- a/zerver/migrations/0293_update_invite_as_dict_values.py +++ b/zerver/migrations/0293_update_invite_as_dict_values.py @@ -1,11 +1,11 @@ # Generated by Django 2.2.13 on 2020-06-21 21:13 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def update_invite_as_dict_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def update_invite_as_dict_values(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: PreregistrationUser = apps.get_model("zerver", "PreregistrationUser") MultiuseInvite = apps.get_model("zerver", "MultiuseInvite") diff --git a/zerver/migrations/0298_fix_realmauditlog_format.py b/zerver/migrations/0298_fix_realmauditlog_format.py index f0afa96f01..a9ab0a9d79 100644 --- a/zerver/migrations/0298_fix_realmauditlog_format.py +++ b/zerver/migrations/0298_fix_realmauditlog_format.py @@ -3,11 +3,11 @@ import json from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def update_realmauditlog_values(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def update_realmauditlog_values(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """ This migration fixes two issues with the RealmAuditLog format for certain event types: * The notifications_stream and signup_notifications_stream fields had the diff --git a/zerver/migrations/0304_remove_default_status_of_default_private_streams.py b/zerver/migrations/0304_remove_default_status_of_default_private_streams.py index 3519f23109..b31e23de13 100644 --- a/zerver/migrations/0304_remove_default_status_of_default_private_streams.py +++ b/zerver/migrations/0304_remove_default_status_of_default_private_streams.py @@ -1,12 +1,12 @@ # Generated by Django 2.2.14 on 2020-08-10 20:21 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def remove_default_status_of_default_private_streams( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: DefaultStream = apps.get_model("zerver", "DefaultStream") DefaultStream.objects.filter(stream__invite_only=True).delete() diff --git a/zerver/migrations/0313_finish_is_user_active_migration.py b/zerver/migrations/0313_finish_is_user_active_migration.py index 4f78dd41ea..1024e4701e 100644 --- a/zerver/migrations/0313_finish_is_user_active_migration.py +++ b/zerver/migrations/0313_finish_is_user_active_migration.py @@ -2,11 +2,11 @@ from django.contrib.postgres.operations import AddIndexConcurrently from django.db import connection, migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def backfill_is_user_active(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_is_user_active(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Subscription = apps.get_model("zerver", "Subscription") BATCH_SIZE = 1000 lower_id_bound = 0 diff --git a/zerver/migrations/0317_migrate_to_invite_to_realm_policy.py b/zerver/migrations/0317_migrate_to_invite_to_realm_policy.py index 438cbd3fae..30a8f09e01 100644 --- a/zerver/migrations/0317_migrate_to_invite_to_realm_policy.py +++ b/zerver/migrations/0317_migrate_to_invite_to_realm_policy.py @@ -1,11 +1,13 @@ # Generated by Django 3.1.7 on 2021-04-01 19:27 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def migrate_to_invite_to_realm_policy(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def migrate_to_invite_to_realm_policy( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: Realm = apps.get_model("zerver", "Realm") Realm.INVITE_TO_REALM_POLICY_MEMBERS_ONLY = 1 Realm.INVITE_TO_REALM_POLICY_ADMINS_ONLY = 2 diff --git a/zerver/migrations/0322_realm_create_audit_log_backfill.py b/zerver/migrations/0322_realm_create_audit_log_backfill.py index 6f703bdf7c..2f49a3369b 100644 --- a/zerver/migrations/0322_realm_create_audit_log_backfill.py +++ b/zerver/migrations/0322_realm_create_audit_log_backfill.py @@ -1,12 +1,12 @@ # Generated by Django 3.1.8 on 2021-04-20 10:09 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def backfill_realm_creation_log_events( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.REALM_CREATED = 215 @@ -25,7 +25,7 @@ def backfill_realm_creation_log_events( RealmAuditLog.objects.bulk_create(objects_to_create) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.REALM_CREATED = 215 RealmAuditLog.objects.filter(event_type=RealmAuditLog.REALM_CREATED, backfilled=True).delete() diff --git a/zerver/migrations/0323_show_starred_message_counts.py b/zerver/migrations/0323_show_starred_message_counts.py index b5788cad6a..8eb5949f43 100644 --- a/zerver/migrations/0323_show_starred_message_counts.py +++ b/zerver/migrations/0323_show_starred_message_counts.py @@ -1,12 +1,14 @@ # Generated by Django 3.1.8 on 2021-05-01 12:34 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # Set starred_message_count for already existing users to True. -def set_starred_message_count_to_true(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_starred_message_count_to_true( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: UserProfile = apps.get_model("zerver", "UserProfile") UserProfile.objects.filter(starred_message_counts=False).update(starred_message_counts=True) diff --git a/zerver/migrations/0328_migrate_to_edit_topic_policy.py b/zerver/migrations/0328_migrate_to_edit_topic_policy.py index 8ed74de769..cf4b485d2f 100644 --- a/zerver/migrations/0328_migrate_to_edit_topic_policy.py +++ b/zerver/migrations/0328_migrate_to_edit_topic_policy.py @@ -1,11 +1,11 @@ # Generated by Django 3.2.2 on 2021-05-26 09:43 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def migrate_to_edit_topic_policy(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def migrate_to_edit_topic_policy(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.POLICY_EVERYONE = 5 Realm.POLICY_ADMINS_ONLY = 2 @@ -18,7 +18,7 @@ def migrate_to_edit_topic_policy(apps: StateApps, schema_editor: DatabaseSchemaE def reverse_migrate_to_edit_topic_policy( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.POLICY_EVERYONE = 5 diff --git a/zerver/migrations/0333_alter_realm_org_type.py b/zerver/migrations/0333_alter_realm_org_type.py index f14e3e1513..df6f29e692 100644 --- a/zerver/migrations/0333_alter_realm_org_type.py +++ b/zerver/migrations/0333_alter_realm_org_type.py @@ -1,11 +1,11 @@ # Generated by Django 3.2.4 on 2021-07-06 20:34 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def reset_realm_org_type(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reset_realm_org_type(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UNSPECIFIED = 0 Realm = apps.get_model("zerver", "Realm") Realm.objects.all().update(org_type=UNSPECIFIED) diff --git a/zerver/migrations/0338_migrate_to_add_custom_emoji_policy.py b/zerver/migrations/0338_migrate_to_add_custom_emoji_policy.py index 1ebf4b557c..43a6b36017 100644 --- a/zerver/migrations/0338_migrate_to_add_custom_emoji_policy.py +++ b/zerver/migrations/0338_migrate_to_add_custom_emoji_policy.py @@ -1,12 +1,12 @@ # Generated by Django 3.2.2 on 2021-05-15 18:01 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def migrate_to_add_custom_emoji_policy( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.ADD_CUSTOM_EMOJI_MEMBERS_ONLY = 1 @@ -20,7 +20,7 @@ def migrate_to_add_custom_emoji_policy( def reverse_migrate_to_add_custom_emoji_policy( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.ADD_CUSTOM_EMOJI_MEMBERS_ONLY = 1 diff --git a/zerver/migrations/0345_alter_realm_name.py b/zerver/migrations/0345_alter_realm_name.py index 541804c0c1..a6c8f52b90 100644 --- a/zerver/migrations/0345_alter_realm_name.py +++ b/zerver/migrations/0345_alter_realm_name.py @@ -2,11 +2,11 @@ from django.conf import settings from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def rename_system_bot_realm(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def rename_system_bot_realm(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: # Prior to this migration, the system bot realm had name incorrectly set to null. Realm = apps.get_model("zerver", "Realm") Realm.objects.filter(name=None, string_id=settings.SYSTEM_BOT_REALM).update( diff --git a/zerver/migrations/0346_create_realm_user_default_table.py b/zerver/migrations/0346_create_realm_user_default_table.py index 12f245ae98..5f41a819c9 100644 --- a/zerver/migrations/0346_create_realm_user_default_table.py +++ b/zerver/migrations/0346_create_realm_user_default_table.py @@ -1,11 +1,13 @@ # Generated by Django 3.2.2 on 2021-06-01 16:19 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def create_realm_user_default_table(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def create_realm_user_default_table( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: Realm = apps.get_model("zerver", "Realm") RealmUserDefault = apps.get_model("zerver", "RealmUserDefault") realms = Realm.objects.all() diff --git a/zerver/migrations/0352_migrate_twenty_four_hour_time_to_realmuserdefault.py b/zerver/migrations/0352_migrate_twenty_four_hour_time_to_realmuserdefault.py index d77ca07879..f50c543462 100644 --- a/zerver/migrations/0352_migrate_twenty_four_hour_time_to_realmuserdefault.py +++ b/zerver/migrations/0352_migrate_twenty_four_hour_time_to_realmuserdefault.py @@ -1,13 +1,13 @@ # Generated by Django 3.2.6 on 2021-09-17 17:08 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F def migrate_twenty_four_hour_time_to_realmuserdefault( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: RealmUserDefault = apps.get_model("zerver", "RealmUserDefault") realm_user_default_objects = RealmUserDefault.objects.exclude( @@ -20,7 +20,7 @@ def migrate_twenty_four_hour_time_to_realmuserdefault( def reverse_migrate_twenty_four_hour_time_to_realmuserdefault( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: RealmUserDefault = apps.get_model("zerver", "RealmUserDefault") realm_user_default_objects = RealmUserDefault.objects.exclude( diff --git a/zerver/migrations/0354_alter_realm_message_content_delete_limit_seconds.py b/zerver/migrations/0354_alter_realm_message_content_delete_limit_seconds.py index 1f50b286ea..17aaaad402 100644 --- a/zerver/migrations/0354_alter_realm_message_content_delete_limit_seconds.py +++ b/zerver/migrations/0354_alter_realm_message_content_delete_limit_seconds.py @@ -1,12 +1,12 @@ # Generated by Django 3.2.4 on 2021-06-14 12:12 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def make_zero_invalid_for_message_delete_limit( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.DEFAULT_MESSAGE_CONTENT_DELETE_LIMIT_SECONDS = 600 @@ -23,7 +23,7 @@ def make_zero_invalid_for_message_delete_limit( def reverse_make_zero_invalid_for_message_delete_limit( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.DEFAULT_MESSAGE_CONTENT_DELETE_LIMIT_SECONDS = 600 diff --git a/zerver/migrations/0356_migrate_to_delete_own_message_policy.py b/zerver/migrations/0356_migrate_to_delete_own_message_policy.py index 653bb6cbbe..ce8aa8614b 100644 --- a/zerver/migrations/0356_migrate_to_delete_own_message_policy.py +++ b/zerver/migrations/0356_migrate_to_delete_own_message_policy.py @@ -1,12 +1,12 @@ # Generated by Django 3.2.4 on 2021-06-09 10:02 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def migrate_to_delete_own_message_policy( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Realm = apps.get_model("zerver", "Realm") Realm.POLICY_EVERYONE = 5 diff --git a/zerver/migrations/0358_split_create_stream_policy.py b/zerver/migrations/0358_split_create_stream_policy.py index c420a7f875..506b9b6e71 100644 --- a/zerver/migrations/0358_split_create_stream_policy.py +++ b/zerver/migrations/0358_split_create_stream_policy.py @@ -1,10 +1,10 @@ from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import F -def copy_stream_policy_field(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def copy_stream_policy_field(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.objects.all().update(create_public_stream_policy=F("create_stream_policy")) Realm.objects.all().update(create_private_stream_policy=F("create_stream_policy")) @@ -15,7 +15,7 @@ def copy_stream_policy_field(apps: StateApps, schema_editor: DatabaseSchemaEdito # but in most cases downgrades that would reverse migrations happen # before any real usage, so it's very likely that both values are # identical. -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Realm.objects.all().update(create_stream_policy=F("create_public_stream_policy")) diff --git a/zerver/migrations/0359_re2_linkifiers.py b/zerver/migrations/0359_re2_linkifiers.py index 7c7449dae5..775856f82f 100644 --- a/zerver/migrations/0359_re2_linkifiers.py +++ b/zerver/migrations/0359_re2_linkifiers.py @@ -1,10 +1,10 @@ import re2 from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def delete_re2_invalid(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def delete_re2_invalid(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: options = re2.Options() options.log_errors = False diff --git a/zerver/migrations/0371_invalid_characters_in_topics.py b/zerver/migrations/0371_invalid_characters_in_topics.py index ed27b8a4da..590b1f56c2 100644 --- a/zerver/migrations/0371_invalid_characters_in_topics.py +++ b/zerver/migrations/0371_invalid_characters_in_topics.py @@ -1,7 +1,7 @@ import unicodedata from django.db import connection, migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # There are 66 Unicode non-characters; see @@ -18,7 +18,7 @@ def character_is_printable(character: str) -> bool: return not (unicodedata.category(character) in ["Cc", "Cs"] or character in unicode_non_chars) -def fix_topics(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_topics(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Message = apps.get_model("zerver", "Message") BATCH_SIZE = 10000 messages_updated = 0 diff --git a/zerver/migrations/0373_fix_deleteduser_dummies.py b/zerver/migrations/0373_fix_deleteduser_dummies.py index 7d214fb010..18f062d856 100644 --- a/zerver/migrations/0373_fix_deleteduser_dummies.py +++ b/zerver/migrations/0373_fix_deleteduser_dummies.py @@ -4,7 +4,7 @@ from django.conf import settings from django.core.exceptions import ValidationError from django.core.validators import validate_email from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps @@ -40,7 +40,7 @@ def get_fake_email_domain(realm: Any) -> str: return settings.FAKE_EMAIL_DOMAIN -def fix_dummy_users(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_dummy_users(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """ do_delete_users had two bugs: 1. Creating the replacement dummy users with active=True diff --git a/zerver/migrations/0374_backfill_user_delete_realmauditlog.py b/zerver/migrations/0374_backfill_user_delete_realmauditlog.py index 3235c920db..0e3e3e83c3 100644 --- a/zerver/migrations/0374_backfill_user_delete_realmauditlog.py +++ b/zerver/migrations/0374_backfill_user_delete_realmauditlog.py @@ -1,9 +1,9 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def backfill_user_deleted_logs(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_user_deleted_logs(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.USER_DELETED = 106 @@ -26,7 +26,7 @@ def backfill_user_deleted_logs(apps: StateApps, schema_editor: DatabaseSchemaEdi RealmAuditLog.objects.bulk_create(objects_to_create) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RealmAuditLog = apps.get_model("zerver", "RealmAuditLog") RealmAuditLog.USER_DELETED = 106 diff --git a/zerver/migrations/0375_invalid_characters_in_stream_names.py b/zerver/migrations/0375_invalid_characters_in_stream_names.py index 3d2803eec1..c440b1167c 100644 --- a/zerver/migrations/0375_invalid_characters_in_stream_names.py +++ b/zerver/migrations/0375_invalid_characters_in_stream_names.py @@ -1,7 +1,7 @@ import unicodedata from django.db import connection, migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps # There are 66 Unicode non-characters; see @@ -18,7 +18,7 @@ def character_is_printable(character: str) -> bool: return not (unicodedata.category(character) in ["Cc", "Cs"] or character in unicode_non_chars) -def fix_stream_names(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_stream_names(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Stream = apps.get_model("zerver", "Stream") Realm = apps.get_model("zerver", "Realm") diff --git a/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py b/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py index 63f86a70d5..c3961242e5 100644 --- a/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py +++ b/zerver/migrations/0376_set_realmemoji_author_and_reupload_realmemoji.py @@ -1,9 +1,9 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def set_emoji_author(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def set_emoji_author(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """ This migration establishes the invariant that all RealmEmoji objects have .author set and queues events for reuploading all RealmEmoji. diff --git a/zerver/migrations/0377_message_edit_history_format.py b/zerver/migrations/0377_message_edit_history_format.py index 223c4e325b..8cc8c0aa25 100644 --- a/zerver/migrations/0377_message_edit_history_format.py +++ b/zerver/migrations/0377_message_edit_history_format.py @@ -3,7 +3,7 @@ from typing import List, Optional, TypedDict import orjson from django.db import migrations, transaction -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Min, Model @@ -116,7 +116,7 @@ def backfill_message_edit_history_chunk(first_id: int, last_id: int, message_mod def copy_and_update_message_edit_history( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Message = apps.get_model("zerver", "Message") ArchivedMessage = apps.get_model("zerver", "ArchivedMessage") diff --git a/zerver/migrations/0380_userprofile_uuid_backfill.py b/zerver/migrations/0380_userprofile_uuid_backfill.py index a3d8df0e77..3f4c7a7df7 100644 --- a/zerver/migrations/0380_userprofile_uuid_backfill.py +++ b/zerver/migrations/0380_userprofile_uuid_backfill.py @@ -1,11 +1,11 @@ import uuid from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps -def backfill_user_profile_uuid(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def backfill_user_profile_uuid(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: UserProfile = apps.get_model("zerver", "UserProfile") max_id = UserProfile.objects.aggregate(models.Max("id"))["id__max"] diff --git a/zerver/migrations/0382_create_role_based_system_groups.py b/zerver/migrations/0382_create_role_based_system_groups.py index 1120bb7c1c..a0a4f67639 100644 --- a/zerver/migrations/0382_create_role_based_system_groups.py +++ b/zerver/migrations/0382_create_role_based_system_groups.py @@ -1,12 +1,14 @@ # Generated by Django 3.2.7 on 2021-10-16 12:41 from django.db import migrations, transaction -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.utils.timezone import now as timezone_now -def create_role_based_system_groups(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def create_role_based_system_groups( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: Realm = apps.get_model("zerver", "Realm") UserProfile = apps.get_model("zerver", "UserProfile") UserGroup = apps.get_model("zerver", "UserGroup") @@ -118,7 +120,9 @@ def create_role_based_system_groups(apps: StateApps, schema_editor: DatabaseSche UserGroupMembership.objects.bulk_create(group_membership_objects) -def delete_role_based_system_groups(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def delete_role_based_system_groups( + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor +) -> None: UserGroup = apps.get_model("zerver", "UserGroup") GroupGroupMembership = apps.get_model("zerver", "GroupGroupMembership") UserGroupMembership = apps.get_model("zerver", "UserGroupMembership") diff --git a/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py b/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py index 736c98524f..6461d254a2 100644 --- a/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py +++ b/zerver/migrations/0383_revoke_invitations_from_deactivated_users.py @@ -1,12 +1,12 @@ from typing import List from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.utils.timezone import now as timezone_now -def revoke_invitations(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def revoke_invitations(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Realm = apps.get_model("zerver", "Realm") Confirmation = apps.get_model("confirmation", "Confirmation") Confirmation.INVITATION = 2 diff --git a/zerver/migrations/0386_fix_attachment_caches.py b/zerver/migrations/0386_fix_attachment_caches.py index 1ffe92f985..27c9af78e1 100644 --- a/zerver/migrations/0386_fix_attachment_caches.py +++ b/zerver/migrations/0386_fix_attachment_caches.py @@ -1,12 +1,12 @@ # Generated by Django 3.2.12 on 2022-03-23 04:32 from django.db import migrations, models -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from django.db.models import Exists, Model, OuterRef -def fix_attachment_caches(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def fix_attachment_caches(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: Attachment = apps.get_model("zerver", "Attachment") ArchivedAttachment = apps.get_model("zerver", "ArchivedAttachment") Message = apps.get_model("zerver", "Message") diff --git a/zerver/migrations/0387_reupload_realmemoji_again.py b/zerver/migrations/0387_reupload_realmemoji_again.py index afd830a5ff..28c9e7e8c6 100644 --- a/zerver/migrations/0387_reupload_realmemoji_again.py +++ b/zerver/migrations/0387_reupload_realmemoji_again.py @@ -1,12 +1,12 @@ from django.conf import settings from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps from zerver.lib.queue import queue_json_publish -def reupload_realm_emoji(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reupload_realm_emoji(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: """As detailed in https://github.com/zulip/zulip/issues/21608, it is possible for the deferred_work queue from Zulip 4.x to have been started up by puppet during the deployment before migrations were diff --git a/zerver/migrations/0390_fix_stream_history_public_to_subscribers.py b/zerver/migrations/0390_fix_stream_history_public_to_subscribers.py index b22ca5edd9..e1250ae93e 100644 --- a/zerver/migrations/0390_fix_stream_history_public_to_subscribers.py +++ b/zerver/migrations/0390_fix_stream_history_public_to_subscribers.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def fix_stream_history_public_to_subscribers( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: Stream = apps.get_model("zerver", "Stream") Stream.objects.filter( diff --git a/zilencer/migrations/0022_remotezulipserver_create_audit_log_backfill.py b/zilencer/migrations/0022_remotezulipserver_create_audit_log_backfill.py index f6ec6bddd0..8c58511d75 100644 --- a/zilencer/migrations/0022_remotezulipserver_create_audit_log_backfill.py +++ b/zilencer/migrations/0022_remotezulipserver_create_audit_log_backfill.py @@ -1,10 +1,10 @@ from django.db import migrations -from django.db.backends.postgresql.schema import DatabaseSchemaEditor +from django.db.backends.postgresql.schema import BaseDatabaseSchemaEditor from django.db.migrations.state import StateApps def backfill_remote_zulip_server_creation_log_events( - apps: StateApps, schema_editor: DatabaseSchemaEditor + apps: StateApps, schema_editor: BaseDatabaseSchemaEditor ) -> None: RemoteZulipServer = apps.get_model("zilencer", "RemoteZulipServer") RemoteZulipServerAuditLog = apps.get_model("zilencer", "RemoteZulipServerAuditLog") @@ -22,7 +22,7 @@ def backfill_remote_zulip_server_creation_log_events( RemoteZulipServerAuditLog.objects.bulk_create(objects_to_create) -def reverse_code(apps: StateApps, schema_editor: DatabaseSchemaEditor) -> None: +def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> None: RemoteZulipServerAuditLog = apps.get_model("zilencer", "RemoteZulipServerAuditLog") RemoteZulipServerAuditLog.REMOTE_SERVER_CREATED = 10215 RemoteZulipServerAuditLog.objects.filter(