# Generated by Django 5.0.7 on 2025-03-15 13:08

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


config = apps.get_app_config("sitevars")


class Migration(migrations.Migration):
    # HACK: If the project has configured a custom site model (or has django.contrib.sites
    # installed), add a migration dependency on it. If not, no dependency is needed, we'll
    # use our PlaceholderSite model.
    dependencies = (
        []
        if config.site_model.lower() == "sitevars.placeholdersite"
        else [migrations.swappable_dependency(config.site_model)]
    )

    operations = [
        migrations.CreateModel(
            name="PlaceholderSite",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "domain",
                    models.CharField(
                        max_length=100, verbose_name="domain name", blank=True
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        max_length=50, verbose_name="display name", blank=True
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="SiteVar",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=100, verbose_name="name")),
                ("value", models.TextField(verbose_name="value")),
                (
                    "site",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="vars",
                        to=config.site_model,
                        verbose_name="site",
                    ),
                ),
            ],
            options={
                "verbose_name": "site variable",
                "verbose_name_plural": "site variables",
                "base_manager_name": "objects",
                "unique_together": {("site", "name")},
            },
        ),
    ]
