# Generated by Django 3.2.21 on 2023-11-16 09:19

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

import baserow.core.mixins
import baserow.core.user_sources.models


class Migration(migrations.Migration):
    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        ("core", "0077_blacklistedtoken"),
    ]

    operations = [
        migrations.CreateModel(
            name="UserSource",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("trashed", models.BooleanField(db_index=True, default=False)),
                ("name", models.CharField(max_length=255)),
                (
                    "order",
                    models.DecimalField(
                        decimal_places=20,
                        default=1,
                        editable=False,
                        help_text="Lowest first.",
                        max_digits=40,
                    ),
                ),
                (
                    "application",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_sources",
                        to="core.application",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=models.SET(
                            baserow.core.user_sources.models.get_default_user_source
                        ),
                        related_name="user_sources",
                        to="contenttypes.contenttype",
                    ),
                ),
                (
                    "integration",
                    models.ForeignKey(
                        help_text="The Integration used to establish the connection with the service.",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="user_sources",
                        to="core.integration",
                    ),
                ),
            ],
            options={
                "ordering": ("order", "id"),
            },
            bases=(
                baserow.core.mixins.PolymorphicContentTypeMixin,
                baserow.core.mixins.WithRegistry,
                baserow.core.mixins.FractionOrderableMixin,
                models.Model,
            ),
        ),
    ]
