# Generated by Django 2.0.9 on 2018-10-04 15:00

import django.core.validators
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

    replaces = [
        ("importer", "0001_initial"),
        ("importer", "0002_auto_20180709_0833"),
        ("importer", "0003_auto_20180709_0933"),
        ("importer", "0004_auto_20180812_1007"),
        ("importer", "0005_auto_20180816_1702"),
        ("importer", "0006_auto_20180912_0229"),
        ("importer", "0007_auto_20180917_1654"),
        ("importer", "0008_campaigntaskdetails_project"),
        ("importer", "0009_convert_project_text_to_keys"),
        ("importer", "0010_auto_20180920_2013"),
        ("importer", "0011_auto_20180922_0208"),
        ("importer", "0012_auto_20180923_0231"),
        ("importer", "0013_auto_20180924_1318"),
        ("importer", "0014_auto_20180924_1943"),
        ("importer", "0015_auto_20180925_1851"),
    ]

    initial = True

    dependencies = [
        ("concordia", "0019_auto_20180920_1503"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("concordia", "0021_auto_20180922_0202"),
        ("concordia", "0024_auto_20180924_1529"),
    ]

    operations = [
        migrations.CreateModel(
            name="ImportItem",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "last_started",
                    models.DateTimeField(
                        blank=True,
                        null=True,
                        verbose_name="Last time when a worker started processing this job",  # NOQA
                    ),
                ),
                (
                    "completed",
                    models.DateTimeField(
                        blank=True,
                        null=True,
                        verbose_name="Time when the job completed processing",
                    ),
                ),
                (
                    "failed",
                    models.DateTimeField(
                        blank=True,
                        null=True,
                        verbose_name="Time when the job failed and will not be restarted",  # NOQA
                    ),
                ),
                (
                    "status",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name="Status message, if any, from the last worker",
                    ),
                ),
                (
                    "task_id",
                    models.UUIDField(
                        blank=True,
                        null=True,
                        verbose_name="UUID of the last Celery task to process this record",  # NOQA
                    ),
                ),
                ("url", models.URLField()),
                (
                    "item",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="concordia.Item"
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ImportItemAsset",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "last_started",
                    models.DateTimeField(
                        blank=True,
                        help_text="Last time when a worker started processing this job",
                        null=True,
                    ),
                ),
                (
                    "completed",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time when the job completed without error",
                        null=True,
                    ),
                ),
                (
                    "failed",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time when the job failed due to an error",
                        null=True,
                    ),
                ),
                (
                    "status",
                    models.TextField(
                        blank=True,
                        default="",
                        help_text="Status message, if any, from the last worker",
                    ),
                ),
                (
                    "task_id",
                    models.UUIDField(
                        blank=True,
                        help_text="UUID of the last Celery task to process this record",
                        null=True,
                    ),
                ),
                ("url", models.URLField()),
                (
                    "sequence_number",
                    models.PositiveIntegerField(
                        validators=[django.core.validators.MinValueValidator(1)]
                    ),
                ),
                (
                    "asset",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="concordia.Asset",
                    ),
                ),
                (
                    "import_item",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="assets",
                        to="importer.ImportItem",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.CreateModel(
            name="ImportJob",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created", models.DateTimeField(auto_now_add=True)),
                ("modified", models.DateTimeField(auto_now=True)),
                (
                    "last_started",
                    models.DateTimeField(
                        blank=True,
                        help_text="Last time when a worker started processing this job",
                        null=True,
                    ),
                ),
                (
                    "completed",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time when the job completed without error",
                        null=True,
                    ),
                ),
                (
                    "failed",
                    models.DateTimeField(
                        blank=True,
                        help_text="Time when the job failed due to an error",
                        null=True,
                    ),
                ),
                (
                    "status",
                    models.TextField(
                        blank=True,
                        default="",
                        help_text="Status message, if any, from the last worker",
                    ),
                ),
                (
                    "task_id",
                    models.UUIDField(
                        blank=True,
                        help_text="UUID of the last Celery task to process this record",
                        null=True,
                    ),
                ),
                ("url", models.URLField(verbose_name="Source URL for the entire job")),
                (
                    "created_by",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "project",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="concordia.Project",
                    ),
                ),
            ],
            options={"abstract": False},
        ),
        migrations.AddField(
            model_name="importitem",
            name="job",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name="items",
                to="importer.ImportJob",
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="status",
            field=models.TextField(
                blank=True,
                default="",
                verbose_name="Status message, if any, from the last worker",
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="completed",
            field=models.DateTimeField(
                blank=True,
                help_text="Time when the job completed without error",
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="failed",
            field=models.DateTimeField(
                blank=True,
                help_text="Time when the job failed due to an error",
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="last_started",
            field=models.DateTimeField(
                blank=True,
                help_text="Last time when a worker started processing this job",
                null=True,
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="status",
            field=models.TextField(
                blank=True,
                default="",
                help_text="Status message, if any, from the last worker",
            ),
        ),
        migrations.AlterField(
            model_name="importitem",
            name="task_id",
            field=models.UUIDField(
                blank=True,
                help_text="UUID of the last Celery task to process this record",
                null=True,
            ),
        ),
        migrations.AlterUniqueTogether(
            name="importitem", unique_together={("job", "item")}
        ),
        migrations.AlterUniqueTogether(
            name="importitemasset",
            unique_together={
                ("import_item", "asset"),
                ("import_item", "sequence_number"),
            },
        ),
    ]
