# Generated by Django 5.0.3 on 2024-04-30 08:18

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


class Migration(migrations.Migration):
    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        ("io", "0004_alter_importsource_status_exportsource"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name="exportsource",
            name="data",
            field=models.JSONField(blank=True, default=dict, null=True),
        ),
        migrations.AlterField(
            model_name="exportsource",
            name="query_str",
            field=models.TextField(blank=True, verbose_name="SQL query to be executed"),
        ),
        migrations.AlterField(
            model_name="exportsource",
            name="resource_path",
            field=models.CharField(
                blank=True, default="", max_length=255, null=True, verbose_name="Resource path to use when exporting"
            ),
        ),
        migrations.AlterField(
            model_name="importsource",
            name="data",
            field=models.JSONField(blank=True, default=dict, null=True),
        ),
        migrations.AddConstraint(
            model_name="exportsource",
            constraint=models.CheckConstraint(
                check=models.Q(
                    models.Q(("query_str__isnull", False), ("resource_path__isnull", False)),
                    models.Q(("data__exact", {}), _negated=True),
                    _connector="OR",
                ),
                name="check_either_data_or_resource_isnotnull",
            ),
        ),
        migrations.AlterField(
            model_name="exportsource",
            name="data",
            field=models.JSONField(blank=True, default=dict, null=True),
        ),
        migrations.AlterField(
            model_name="exportsource",
            name="format",
            field=models.IntegerField(
                choices=[(0, "CSV"), (1, "XLSX"), (2, "TSV"), (3, "JSON"), (4, "YAML")],
                default=0,
                verbose_name="Format of file to be exported",
            ),
        ),
        migrations.AlterField(
            model_name="importsource",
            name="data",
            field=models.JSONField(blank=True, default=dict, null=True),
        ),
    ]
