2020-01-21 06:35:58 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Generated by Django 1.11.15 on 2019-01-31 22:18
|
|
|
|
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", "0084_contest_formats"),
|
2020-01-21 06:35:58 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
2022-05-14 17:57:27 +00:00
|
|
|
name="SubmissionSource",
|
2020-01-21 06:35:58 +00:00
|
|
|
fields=[
|
2022-05-14 17:57:27 +00:00
|
|
|
(
|
|
|
|
"id",
|
|
|
|
models.AutoField(
|
|
|
|
auto_created=True,
|
|
|
|
primary_key=True,
|
|
|
|
serialize=False,
|
|
|
|
verbose_name="ID",
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"source",
|
|
|
|
models.TextField(max_length=65536, verbose_name="source code"),
|
|
|
|
),
|
|
|
|
(
|
|
|
|
"submission",
|
|
|
|
models.OneToOneField(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="link",
|
|
|
|
to="judge.Submission",
|
|
|
|
verbose_name="associated submission",
|
|
|
|
),
|
|
|
|
),
|
2020-01-21 06:35:58 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
migrations.RunSQL(
|
2022-05-14 17:57:27 +00:00
|
|
|
[
|
|
|
|
"""INSERT INTO judge_submissionsource (source, submission_id)
|
|
|
|
SELECT source, id AS 'submission_id' FROM judge_submission;"""
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"""UPDATE judge_submission sub
|
2020-01-21 06:35:58 +00:00
|
|
|
INNER JOIN judge_submissionsource src ON sub.id = src.submission_id
|
2022-05-14 17:57:27 +00:00
|
|
|
SET sub.source = src.source;"""
|
|
|
|
],
|
2020-01-21 06:35:58 +00:00
|
|
|
elidable=True,
|
|
|
|
),
|
|
|
|
migrations.RemoveField(
|
2022-05-14 17:57:27 +00:00
|
|
|
model_name="submission",
|
|
|
|
name="source",
|
2020-01-21 06:35:58 +00:00
|
|
|
),
|
|
|
|
migrations.AlterField(
|
2022-05-14 17:57:27 +00:00
|
|
|
model_name="submissionsource",
|
|
|
|
name="submission",
|
|
|
|
field=models.OneToOneField(
|
|
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
|
|
related_name="source",
|
|
|
|
to="judge.Submission",
|
|
|
|
verbose_name="associated submission",
|
|
|
|
),
|
2020-01-21 06:35:58 +00:00
|
|
|
),
|
|
|
|
]
|