NDOJ/judge/migrations/0089_submission_to_contest.py

38 lines
1.2 KiB
Python
Raw Normal View History

2020-01-21 06:35:58 +00:00
# Generated by Django 2.1.12 on 2019-09-25 23:28
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
2022-05-14 17:57:27 +00:00
("judge", "0088_private_contests"),
2020-01-21 06:35:58 +00:00
]
operations = [
migrations.AddField(
2022-05-14 17:57:27 +00:00
model_name="submission",
name="contest_object",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="+",
to="judge.Contest",
verbose_name="contest",
),
2020-01-21 06:35:58 +00:00
),
2022-05-14 17:57:27 +00:00
migrations.RunSQL(
"""
2020-01-21 06:35:58 +00:00
UPDATE `judge_submission`
INNER JOIN `judge_contestsubmission`
ON (`judge_submission`.`id` = `judge_contestsubmission`.`submission_id`)
INNER JOIN `judge_contestparticipation`
ON (`judge_contestsubmission`.`participation_id` = `judge_contestparticipation`.`id`)
SET `judge_submission`.`contest_object_id` = `judge_contestparticipation`.`contest_id`
2022-05-14 17:57:27 +00:00
""",
migrations.RunSQL.noop,
),
2020-01-21 06:35:58 +00:00
]