# Generated by Django 4.2.6 on 2023-10-28 23:13

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

SENTINEL_NULL_USER_ID = getattr(settings, "SENTINEL_NULL_USER_ID", -1)


def add_sentinel_user(apps, schema_editor):
    UserModel = apps.get_model(settings.AUTH_USER_MODEL)
    UserModel.objects.get_or_create(pk=SENTINEL_NULL_USER_ID)


def remove_sentinel_user(apps, schema_editor):
    UserModel = apps.get_model(settings.AUTH_USER_MODEL)
    UserModel.objects.filter(pk=SENTINEL_NULL_USER_ID).delete()


class Migration(migrations.Migration):
    initial = True

    dependencies = [
        (
            "auth",
            "0012_alter_user_first_name_max_length",
        ),  # Ensure this dependency matches your current Django version's auth migration
        ("django_anchor_modeling", "0001_initial"),
    ]

    operations = [
        migrations.RunPython(add_sentinel_user, remove_sentinel_user),
    ]
