Add data migration
This commit is contained in:
parent
6317df0cc8
commit
6025075818
|
|
@ -0,0 +1,22 @@
|
||||||
|
# Generated by Django 3.2.20 on 2023-12-07 14:01
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def add_field_to_json(apps, _schema_editor):
|
||||||
|
FeedbackResponse = apps.get_model("feedback", "FeedbackResponse")
|
||||||
|
for instance in FeedbackResponse.objects.all():
|
||||||
|
if instance.data is None:
|
||||||
|
instance.data = {}
|
||||||
|
instance.data["feedback_type"] = "uk" # Set the default value
|
||||||
|
instance.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("feedback", "0006_auto_20230922_1131"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(add_field_to_json),
|
||||||
|
]
|
||||||
Loading…
Reference in New Issue