migrations: Add missing elidable tags on RunPython/RunSQL steps.

This helps the squashmigrations tool know that it can squash these.
This commit is contained in:
Tim Abbott 2024-08-13 09:31:43 -07:00
parent 5188cf3d8e
commit afecb2eca6
40 changed files with 74 additions and 28 deletions

View File

@ -26,5 +26,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(delete_messages_sent_to_stream_stat), migrations.RunPython(delete_messages_sent_to_stream_stat, elidable=True),
] ]

View File

@ -24,5 +24,5 @@ class Migration(migrations.Migration):
dependencies = [("analytics", "0009_remove_messages_to_stream_stat")] dependencies = [("analytics", "0009_remove_messages_to_stream_stat")]
operations = [ operations = [
migrations.RunPython(clear_message_sent_by_message_type_values), migrations.RunPython(clear_message_sent_by_message_type_values, elidable=True),
] ]

View File

@ -23,5 +23,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(clear_analytics_tables), migrations.RunPython(clear_analytics_tables, elidable=True),
] ]

View File

@ -60,5 +60,7 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(clear_duplicate_counts, reverse_code=migrations.RunPython.noop), migrations.RunPython(
clear_duplicate_counts, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]

View File

@ -10,6 +10,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunSQL( migrations.RunSQL(
"DELETE FROM analytics_usercount WHERE property = 'active_users_audit:is_bot:day'" "DELETE FROM analytics_usercount WHERE property = 'active_users_audit:is_bot:day'",
elidable=True,
) )
] ]

View File

@ -21,6 +21,7 @@ class Migration(migrations.Migration):
"DELETE FROM analytics_installationcount WHERE property IN %s", "DELETE FROM analytics_installationcount WHERE property IN %s",
(REMOVED_COUNTS,), (REMOVED_COUNTS,),
), ),
] ],
elidable=True,
) )
] ]

View File

@ -13,6 +13,7 @@ class Migration(migrations.Migration):
SET customer_id = ( SET customer_id = (
SELECT id FROM corporate_customer WHERE corporate_customer.realm_id = corporate_zulipsponsorshiprequest.realm_id SELECT id FROM corporate_customer WHERE corporate_customer.realm_id = corporate_zulipsponsorshiprequest.realm_id
) )
""" """,
elidable=True,
), ),
] ]

View File

@ -24,5 +24,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(update_legacy_plan_next_invoice_date), migrations.RunPython(update_legacy_plan_next_invoice_date, elidable=True),
] ]

View File

@ -36,5 +36,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(fix_customer_plans_scheduled_after_legacy_plan), migrations.RunPython(fix_customer_plans_scheduled_after_legacy_plan, elidable=True),
] ]

View File

@ -58,5 +58,6 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunPython( migrations.RunPython(
backfill_end_date_for_fixed_price_plans, backfill_end_date_for_fixed_price_plans,
elidable=True,
), ),
] ]

View File

@ -46,5 +46,6 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunPython( migrations.RunPython(
fix_plans_on_free_trial_with_changes_in_schedule, fix_plans_on_free_trial_with_changes_in_schedule,
elidable=True,
), ),
] ]

View File

@ -75,7 +75,7 @@ class Migration(migrations.Migration):
field=models.IntegerField(default=0), field=models.IntegerField(default=0),
), ),
# Populate the new discounted price fields based on existing default discount. # Populate the new discounted price fields based on existing default discount.
migrations.RunPython(calculate_discounted_price), migrations.RunPython(calculate_discounted_price, elidable=True),
migrations.RemoveField( migrations.RemoveField(
model_name="customer", model_name="customer",
name="default_discount", name="default_discount",

View File

@ -36,6 +36,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunPython( migrations.RunPython(
clear_preregistrationuser_invited_as_admin, reverse_code=migrations.RunPython.noop clear_preregistrationuser_invited_as_admin,
reverse_code=migrations.RunPython.noop,
elidable=True,
), ),
] ]

View File

@ -23,5 +23,6 @@ class Migration(migrations.Migration):
AND zerver_stream.deactivated; AND zerver_stream.deactivated;
""", """,
reverse_sql="", reverse_sql="",
elidable=True,
), ),
] ]

View File

@ -26,5 +26,6 @@ class Migration(migrations.Migration):
END; END;
""", """,
reverse_sql="", reverse_sql="",
elidable=True,
), ),
] ]

View File

@ -41,7 +41,9 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(backfill_is_user_active, reverse_code=migrations.RunPython.noop), migrations.RunPython(
backfill_is_user_active, reverse_code=migrations.RunPython.noop, elidable=True
),
# Make the field non-null now that we backfilled. # Make the field non-null now that we backfilled.
migrations.AlterField( migrations.AlterField(
model_name="subscription", model_name="subscription",

View File

@ -75,5 +75,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(fix_topics, reverse_code=migrations.RunPython.noop), migrations.RunPython(fix_topics, reverse_code=migrations.RunPython.noop, elidable=True),
] ]

View File

@ -83,5 +83,6 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
fix_dummy_users, fix_dummy_users,
reverse_code=migrations.RunPython.noop, reverse_code=migrations.RunPython.noop,
elidable=True,
) )
] ]

View File

@ -76,5 +76,9 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(fix_stream_names, reverse_code=migrations.RunPython.noop), migrations.RunPython(
fix_stream_names,
reverse_code=migrations.RunPython.noop,
elidable=True,
),
] ]

View File

@ -38,5 +38,7 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(set_emoji_author, reverse_code=migrations.RunPython.noop), migrations.RunPython(
set_emoji_author, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]

View File

@ -164,5 +164,6 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
copy_and_update_message_edit_history, copy_and_update_message_edit_history,
reverse_code=migrations.RunPython.noop, reverse_code=migrations.RunPython.noop,
elidable=True,
), ),
] ]

View File

@ -36,5 +36,7 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(backfill_user_profile_uuid, reverse_code=migrations.RunPython.noop), migrations.RunPython(
backfill_user_profile_uuid, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]

View File

@ -72,5 +72,7 @@ class Migration(migrations.Migration):
to="zerver.ArchivedMessage", to="zerver.ArchivedMessage",
), ),
), ),
migrations.RunPython(fix_attachment_caches, reverse_code=migrations.RunPython.noop), migrations.RunPython(
fix_attachment_caches, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]

View File

@ -43,5 +43,7 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(reupload_realm_emoji, reverse_code=migrations.RunPython.noop), migrations.RunPython(
reupload_realm_emoji, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]

View File

@ -18,7 +18,8 @@ class Migration(migrations.Migration):
migrations.RunSQL( migrations.RunSQL(
""" """
DELETE FROM zerver_usertopic WHERE id NOT IN (SELECT max(id) FROM zerver_usertopic GROUP BY (user_profile_id, stream_id, upper(topic_name::text))); DELETE FROM zerver_usertopic WHERE id NOT IN (SELECT max(id) FROM zerver_usertopic GROUP BY (user_profile_id, stream_id, upper(topic_name::text)));
""" """,
elidable=True,
), ),
migrations.AddConstraint( migrations.AddConstraint(
model_name="usertopic", model_name="usertopic",

View File

@ -49,5 +49,5 @@ class Migration(migrations.Migration):
"unique_together": {("realm", "name")}, "unique_together": {("realm", "name")},
}, },
), ),
migrations.RunPython(fill_RealmAuthenticationMethod_data), migrations.RunPython(fill_RealmAuthenticationMethod_data, elidable=True),
] ]

View File

@ -66,4 +66,6 @@ class Migration(migrations.Migration):
("zerver", "0443_userpresence_new_table_schema"), ("zerver", "0443_userpresence_new_table_schema"),
] ]
operations = [migrations.RunPython(fill_new_columns, reverse_code=clear_new_columns)] operations = [
migrations.RunPython(fill_new_columns, reverse_code=clear_new_columns, elidable=True)
]

View File

@ -20,6 +20,7 @@ class Migration(migrations.Migration):
SET trigger = 'wildcard_mentioned' SET trigger = 'wildcard_mentioned'
WHERE trigger = 'stream_wildcard_mentioned'; WHERE trigger = 'stream_wildcard_mentioned';
""", """,
elidable=True,
), ),
migrations.RunSQL( migrations.RunSQL(
""" """
@ -32,5 +33,6 @@ class Migration(migrations.Migration):
SET trigger = 'followed_topic_wildcard_mentioned' SET trigger = 'followed_topic_wildcard_mentioned'
WHERE trigger = 'stream_wildcard_mentioned_in_followed_topic'; WHERE trigger = 'stream_wildcard_mentioned_in_followed_topic';
""", """,
elidable=True,
), ),
] ]

View File

@ -20,5 +20,6 @@ class Migration(migrations.Migration):
SET trigger = 'private_message' SET trigger = 'private_message'
WHERE trigger = 'direct_message'; WHERE trigger = 'direct_message';
""", """,
elidable=True,
), ),
] ]

View File

@ -91,5 +91,6 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
update_for_followup_day_email_templates_rename, update_for_followup_day_email_templates_rename,
reverse_code=revert_followup_day_email_templates_rename, reverse_code=revert_followup_day_email_templates_rename,
elidable=True,
), ),
] ]

View File

@ -64,6 +64,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunPython( migrations.RunPython(
backfill_realm_uuid_and_secret, reverse_code=migrations.RunPython.noop backfill_realm_uuid_and_secret,
reverse_code=migrations.RunPython.noop,
elidable=True,
), ),
] ]

View File

@ -42,6 +42,7 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
populate_read_by_sender, populate_read_by_sender,
reverse_code=migrations.RunPython.noop, reverse_code=migrations.RunPython.noop,
elidable=True,
), ),
migrations.AlterField( migrations.AlterField(
model_name="scheduledmessage", model_name="scheduledmessage",

View File

@ -36,5 +36,6 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
set_initial_value_for_zulip_update_announcements_stream, set_initial_value_for_zulip_update_announcements_stream,
reverse_code=migrations.RunPython.noop, reverse_code=migrations.RunPython.noop,
elidable=True,
), ),
] ]

View File

@ -202,7 +202,9 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunSQL(BUILD_BAD_MOVES_TABLE, elidable=True), migrations.RunSQL(BUILD_BAD_MOVES_TABLE, elidable=True),
migrations.RunSQL(BROADEN_MOVES, elidable=True), migrations.RunSQL(BROADEN_MOVES, elidable=True),
migrations.RunPython(log_extra_usermessage_rows, reverse_code=migrations.RunPython.noop), migrations.RunPython(
log_extra_usermessage_rows, reverse_code=migrations.RunPython.noop, elidable=True
),
migrations.RunSQL( migrations.RunSQL(
""" """
DELETE FROM zerver_usermessage DELETE FROM zerver_usermessage

View File

@ -71,5 +71,6 @@ class Migration(migrations.Migration):
migrations.RunPython( migrations.RunPython(
mark_introduce_zulip_view_modals_as_read, mark_introduce_zulip_view_modals_as_read,
reverse_code=mark_introduce_zulip_view_modals_as_unread, reverse_code=mark_introduce_zulip_view_modals_as_unread,
elidable=True,
), ),
] ]

View File

@ -8,6 +8,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RunSQL( migrations.RunSQL(
"UPDATE zerver_realm SET delete_own_message_policy = 1 where string_id = 'zulipinternal'" "UPDATE zerver_realm SET delete_own_message_policy = 1 where string_id = 'zulipinternal'",
elidable=True,
) )
] ]

View File

@ -87,10 +87,9 @@ def purge_nagios_messages(apps: StateApps, schema_editor: BaseDatabaseSchemaEdit
class Migration(migrations.Migration): class Migration(migrations.Migration):
atomic = False atomic = False
elidable = True
dependencies = [ dependencies = [
("zerver", "0563_zulipinternal_can_delete"), ("zerver", "0563_zulipinternal_can_delete"),
] ]
operations = [migrations.RunPython(purge_nagios_messages)] operations = [migrations.RunPython(purge_nagios_messages, elidable=True)]

View File

@ -32,5 +32,6 @@ class Migration(migrations.Migration):
# The updated table is still valid with the old schema; # The updated table is still valid with the old schema;
# so to reverse, a no-op suffices. # so to reverse, a no-op suffices.
reverse_sql=[], reverse_sql=[],
elidable=True,
), ),
] ]

View File

@ -49,7 +49,9 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(clear_duplicate_counts, reverse_code=migrations.RunPython.noop), migrations.RunPython(
clear_duplicate_counts, reverse_code=migrations.RunPython.noop, elidable=True
),
migrations.AddConstraint( migrations.AddConstraint(
model_name="remoteinstallationcount", model_name="remoteinstallationcount",
constraint=models.UniqueConstraint( constraint=models.UniqueConstraint(

View File

@ -35,5 +35,7 @@ class Migration(migrations.Migration):
name="plan_type", name="plan_type",
field=models.PositiveSmallIntegerField(default=PLAN_TYPE_SELF_MANAGED), field=models.PositiveSmallIntegerField(default=PLAN_TYPE_SELF_MANAGED),
), ),
migrations.RunPython(renumber_plan_types, reverse_code=migrations.RunPython.noop), migrations.RunPython(
renumber_plan_types, reverse_code=migrations.RunPython.noop, elidable=True
),
] ]