From 7f770ad0c3bd71c7dd5d43a6770afa324f6a0054 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Wed, 27 Mar 2024 14:38:13 -0400 Subject: [PATCH] feat: add migration to attach notes to existing timeslots --- program/migrations/0085_attach_notes.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 program/migrations/0085_attach_notes.py diff --git a/program/migrations/0085_attach_notes.py b/program/migrations/0085_attach_notes.py new file mode 100644 index 00000000..3d3a9fae --- /dev/null +++ b/program/migrations/0085_attach_notes.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.11 on 2024-03-26 22:07 + +from django.db import migrations + + +def attach_notes(apps, _): + Note = apps.get_model("program", "Note") + Timeslot = apps.get_model("program", "TimeSlot") + + for timeslot in Timeslot.objects.filter(note=None): + Note.objects.create(timeslot=timeslot) + timeslot.save() + + +class Migration(migrations.Migration): + dependencies = [ + ("program", "0084_alter_note_title"), + ] + + operations = [migrations.RunPython(code=attach_notes)] -- GitLab