# Generated by Django 3.2.8 on 2021-10-13 23:04

from django.db import migrations, models


def set_project_details(apps, schema_editor):
    # Old values in output field of delta table where string instead of json
    Project = apps.get_model("core", "Project")
    ProcessProjectfileJob = apps.get_model("core", "ProcessProjectfileJob")

    for project in Project.objects.filter(project_filename__isnull=False):
        ProcessProjectfileJob.objects.create(
            project=project,
            created_by=project.owner,
            type="process_projectfile",
        )


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0045_auto_20211012_2234"),
    ]

    operations = [
        migrations.AddField(
            model_name="project",
            name="project_details",
            field=models.JSONField(blank=True, null=True),
        ),
        migrations.RunPython(set_project_details, migrations.RunPython.noop),
    ]

# Generated by Django 3.2.8 on 2021-10-13 23:04

from django.db import migrations, models


def set_project_details(apps, schema_editor):
    # Old values in output field of delta table where string instead of json
    Project = apps.get_model("core", "Project")
    ProcessProjectfileJob = apps.get_model("core", "ProcessProjectfileJob")

    for project in Project.objects.filter(project_filename__isnull=False):
        ProcessProjectfileJob.objects.create(
            project=project,
            created_by=project.owner,
            type="process_projectfile",
        )


class Migration(migrations.Migration):

    dependencies = [
        ("core", "0045_auto_20211012_2234"),
    ]

    operations = [
        migrations.AddField(
            model_name="project",
            name="project_details",
            field=models.JSONField(blank=True, null=True),
        ),
        migrations.RunPython(set_project_details, migrations.RunPython.noop),
    ]

# Generated by Django 3.2.8 on 2021-10-13 23:04 # Old values in output field of delta table where string instead of json