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)
This commit is contained in:
Yulya Artyukhina 2023-11-02 17:40:26 +01:00 committed by GitHub
parent ea8a2fcf41
commit c9ce61efd7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View file

@ -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

View file

@ -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),
]