# Generated by Django 4.2.10 on 2024-03-22 19:24

from django.db import migrations, models
from arches.app.models import models as ArchesModels
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ("models", "10799_geojsongeometry_featureid"),
    ]

    operations = [
        migrations.RenameField(
            model_name="spatialview",
            old_name="geometrynodeid",
            new_name="geometrynode",
        ),
        migrations.AlterField(
            model_name="spatialview",
            name="geometrynode",
            field=models.ForeignKey(
                db_column="geometrynodeid",
                limit_choices_to={"datatype": "geojson-feature-collection"},
                on_delete=django.db.models.deletion.CASCADE,
                to="models.node",
            ),
        ),
        migrations.AddField(
            model_name="spatialview",
            name="language",
            field=models.ForeignKey(
                db_column="languageid",
                default="en",
                on_delete=django.db.models.deletion.PROTECT,
                to="models.language",
                to_field="code",
            ),
            preserve_default=False,
        ),
        # no need to forward migrate data to account for not-null constraint being added as the db trigger function on the spatialviews table never allowed null values
        # or empty list. A DB error was always raised, so this just adds a constraint to the model to enforce this requirement in the ORM.
        migrations.AlterField(
            model_name="spatialview",
            name="attributenodes",
            field=models.JSONField(db_column="attributenodes"),
        ),
    ]
