# Generated by Django 3.2.12 on 2022-03-02 10:08

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


class Migration(migrations.Migration):
    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("core", "0015_alter_userprofile_language"),
        ("database", "0065_rename_old_generated_table_indexes"),
    ]

    operations = [
        migrations.CreateModel(
            name="AirtableImportJob",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("created_on", models.DateTimeField(auto_now_add=True)),
                ("updated_on", models.DateTimeField(auto_now=True)),
                (
                    "airtable_share_id",
                    models.CharField(
                        help_text="Public ID of the shared Airtable base that must be imported.",
                        max_length=18,
                    ),
                ),
                ("timezone", models.CharField(max_length=255, null=True)),
                (
                    "progress_percentage",
                    models.IntegerField(
                        default=0,
                        help_text="A percentage indicating how far along the import job is. 100 means that it's finished.",
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        default="pending",
                        help_text="Indicates the state of the import job.",
                        max_length=128,
                    ),
                ),
                (
                    "error",
                    models.TextField(
                        blank=True,
                        default="",
                        help_text="An error message if something went wrong.",
                    ),
                ),
                (
                    "human_readable_error",
                    models.TextField(
                        blank=True,
                        default="",
                        help_text="A human readable error message indicating what went wrong.",
                    ),
                ),
                (
                    "database",
                    models.ForeignKey(
                        help_text="The imported Baserow database.",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to="core.application",
                    ),
                ),
                (
                    "group",
                    models.ForeignKey(
                        help_text="The group where the Airtable base must be imported into.",
                        on_delete=django.db.models.deletion.CASCADE,
                        to="core.group",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="The user that has created the job",
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "abstract": False,
            },
        ),
    ]
