From 8c329dca7d79469eaa6c693173187fdddb6ac27e Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 22 Feb 2020 19:26:34 +0100 Subject: [PATCH] core: add migration to fix null fields in core.application --- .../migrations/0011_auto_20200222_1822.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 passbook/core/migrations/0011_auto_20200222_1822.py diff --git a/passbook/core/migrations/0011_auto_20200222_1822.py b/passbook/core/migrations/0011_auto_20200222_1822.py new file mode 100644 index 000000000..fae2af4f1 --- /dev/null +++ b/passbook/core/migrations/0011_auto_20200222_1822.py @@ -0,0 +1,27 @@ +# Generated by Django 3.0.3 on 2020-02-22 18:22 + +from django.db import migrations + + +def fix_application_null(apps, schema_editor): + """Fix Application meta_fields being null""" + Application = apps.get_model("passbook_core", "Application") + for app in Application.objects.all(): + if app.meta_launch_url is None: + app.meta_launch_url = "" + if app.meta_icon_url is None: + app.meta_icon_url = "" + if app.meta_description is None: + app.meta_description = "" + if app.meta_publisher is None: + app.meta_publisher = "" + app.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ("passbook_core", "0010_auto_20200221_2208"), + ] + + operations = [migrations.RunPython(fix_application_null)]