Skip to content

Commit

Permalink
migration to add links to inital migration session
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Apr 10, 2024
1 parent bcab541 commit 3fc1add
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions crowdsourcer/migrations/0040_link_to_initial_marking_session.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 4.2.5 on 2024-04-10 15:43

from django.db import migrations


def link_initial_marking_session(apps, schema_editor):
MarkingSession = apps.get_model("crowdsourcer", "MarkingSession")
Assigned = apps.get_model("crowdsourcer", "Assigned")
ResponseType = apps.get_model("crowdsourcer", "ResponseType")
Section = apps.get_model("crowdsourcer", "Section")

initial = MarkingSession.objects.first()

Assigned.objects.update(marking_session=initial)
ResponseType.objects.update(marking_session=initial)
Section.objects.update(marking_session=initial)


class Migration(migrations.Migration):

dependencies = [
("crowdsourcer", "0039_add_marking_session_links"),
]

operations = [
migrations.RunPython(link_initial_marking_session),
]

0 comments on commit 3fc1add

Please sign in to comment.