# Generated by Django 4.1.1 on 2022-09-27 19:31

import django.db.models.deletion
from django.db import migrations
from django.db import models


class Migration(migrations.Migration):
    dependencies = [
        ("django_celery_results", "0011_taskresult_periodic_task_name"),
        ("documents", "1025_alter_savedviewfilterrule_rule_type"),
    ]

    operations = [
        migrations.RemoveField(
            model_name="paperlesstask",
            name="created",
        ),
        migrations.RemoveField(
            model_name="paperlesstask",
            name="name",
        ),
        migrations.RemoveField(
            model_name="paperlesstask",
            name="started",
        ),
        # Remove the field from the model
        migrations.RemoveField(
            model_name="paperlesstask",
            name="attempted_task",
        ),
        # Add the field back, pointing to the correct model
        # This resolves a problem where the temporary change in 1022
        # results in a type mismatch
        migrations.AddField(
            model_name="paperlesstask",
            name="attempted_task",
            field=models.OneToOneField(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                related_name="attempted_task",
                to="django_celery_results.taskresult",
            ),
        ),
        # Drop the django-q tables entirely
        # Must be done last or there could be references here
        migrations.RunSQL(
            "DROP TABLE IF EXISTS django_q_ormq",
            reverse_sql=migrations.RunSQL.noop,
        ),
        migrations.RunSQL(
            "DROP TABLE IF EXISTS django_q_schedule",
            reverse_sql=migrations.RunSQL.noop,
        ),
        migrations.RunSQL(
            "DROP TABLE IF EXISTS django_q_task",
            reverse_sql=migrations.RunSQL.noop,
        ),
    ]
