# Generated by Django 4.2.15 on 2024-08-30 14:33

import arches.app.models.fields.i18n
import arches.app.utils.betterJSONSerializer
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("models", "10121_workflowhistory"),
    ]

    operations = [
        migrations.CreateModel(
            name="ResourceSet",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        primary_key=True,
                        serialize=False
                    ),
                ),
                (
                    "description",
                    arches.app.models.fields.i18n.I18n_TextField(
                        blank=True,
                        default="",
                        encoder=arches.app.utils.betterJSONSerializer.JSONSerializer,
                        null=True,
                    ),
                ),
                ("date_created", models.DateTimeField(auto_now_add=True)),
                ("date_updated", models.DateTimeField(auto_now=True)),
                (
                    "owner",
                    models.ForeignKey(
                        db_column="userid",
                        on_delete=django.db.models.deletion.CASCADE,
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "db_table": "resource_set",
                "managed": True,
            },
        ),
        migrations.CreateModel(
            name="ResourceSetMember",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "resource_instance",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="models.resourceinstance",
                    ),
                ),
                (
                    "resource_set",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to="arches_resource_sets.resourceset",
                    ),
                ),
            ],
            options={
                "db_table": "resource_set_member",
                "managed": True,
                "unique_together": {("resource_set", "resource_instance")},
            },
        ),
    ]
