From c9ce61efd79f677b4d70026f5391f3f37aa418e2 Mon Sep 17 00:00:00 2001 From: Yulya Artyukhina Date: Thu, 2 Nov 2023 17:40:26 +0100 Subject: [PATCH] Fix db migration for mobile app (#3260) # What this PR does Fixes bd migration ## Which issue(s) this PR fixes Closes https://github.com/grafana/oncall/issues/3222 ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- CHANGELOG.md | 4 ++++ ...sersettings_going_oncall_notification_timing.py | 14 +++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0edbcb4e..fc8f47fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Fixed + +- Fix db migration for mobile app @Ferril ([#3260](https://github.com/grafana/oncall/pull/3260)) + ## v1.3.52 (2023-11-02) ### Fixed diff --git a/engine/apps/mobile_app/migrations/0011_alter_mobileappusersettings_going_oncall_notification_timing.py b/engine/apps/mobile_app/migrations/0011_alter_mobileappusersettings_going_oncall_notification_timing.py index c758fa8c..cdeac8fc 100644 --- a/engine/apps/mobile_app/migrations/0011_alter_mobileappusersettings_going_oncall_notification_timing.py +++ b/engine/apps/mobile_app/migrations/0011_alter_mobileappusersettings_going_oncall_notification_timing.py @@ -4,13 +4,6 @@ import apps.mobile_app.models import django_migration_linter as linter from django.db import migrations, models -from apps.mobile_app.models import default_notification_timing_options - - -def set_going_oncall_notification_timing_to_default(apps, schema_editor): - MobileAppUserSettings = apps.get_model("mobile_app", "MobileAppUserSettings") - default = default_notification_timing_options() - MobileAppUserSettings.objects.all().update(going_oncall_notification_timing=default) class Migration(migrations.Migration): @@ -21,10 +14,13 @@ class Migration(migrations.Migration): operations = [ linter.IgnoreMigration(), - migrations.AlterField( + migrations.RemoveField( + model_name='mobileappusersettings', + name='going_oncall_notification_timing', + ), + migrations.AddField( model_name='mobileappusersettings', name='going_oncall_notification_timing', field=models.JSONField(default=apps.mobile_app.models.default_notification_timing_options), ), - migrations.RunPython(set_going_oncall_notification_timing_to_default, migrations.RunPython.noop), ]