mirror of https://github.com/zulip/zulip.git
migrations: Fix revert migration to not lose all preferences.
Renumbering 4 -> 3, and then 3 -> 2 leads to everyone having their preferences set to 2. Swap the order, so that we renumber 3 -> 2, then 4 -> 3.
This commit is contained in:
parent
2e818a071e
commit
8b0cecc7e4
|
@ -40,18 +40,18 @@ def reverse_code(apps: StateApps, schema_editor: BaseDatabaseSchemaEditor) -> No
|
||||||
UserProfile = apps.get_model("zerver", "UserProfile")
|
UserProfile = apps.get_model("zerver", "UserProfile")
|
||||||
|
|
||||||
UserProfile.objects.filter(
|
UserProfile.objects.filter(
|
||||||
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_NONE
|
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION
|
||||||
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_NONE)
|
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION)
|
||||||
RealmUserDefault.objects.filter(
|
RealmUserDefault.objects.filter(
|
||||||
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_NONE
|
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION
|
||||||
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_NONE)
|
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION)
|
||||||
|
|
||||||
UserProfile.objects.filter(
|
UserProfile.objects.filter(
|
||||||
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION
|
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_NONE
|
||||||
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION)
|
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_NONE)
|
||||||
RealmUserDefault.objects.filter(
|
RealmUserDefault.objects.filter(
|
||||||
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION
|
desktop_icon_count_display=NEW_DESKTOP_ICON_COUNT_DISPLAY_NONE
|
||||||
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_DM_MENTION)
|
).update(desktop_icon_count_display=OLD_DESKTOP_ICON_COUNT_DISPLAY_NONE)
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
Loading…
Reference in New Issue