# Generated by Django 5.2.10 on 2026-02-02 16:55

from django.db import migrations


SQLITE_FAQ_REFERENCE = {
    "value": "https://www.sqlite.org/faq.html",
    "alt_text": "SQLite FAQ",
}


def remove_sqlite_faq_reference(apps, schema_editor):
    Reference = apps.get_model("links", "Reference")
    Reference.objects.filter(
        value=SQLITE_FAQ_REFERENCE["value"],
        alt_text=SQLITE_FAQ_REFERENCE["alt_text"],
    ).delete()


def restore_sqlite_faq_reference(apps, schema_editor):
    Reference = apps.get_model("links", "Reference")
    Reference.objects.get_or_create(
        value=SQLITE_FAQ_REFERENCE["value"],
        alt_text=SQLITE_FAQ_REFERENCE["alt_text"],
        defaults={
            "method": "link",
            "include_in_footer": True,
            "footer_visibility": "public",
            "is_seed_data": True,
        },
    )


class Migration(migrations.Migration):

    dependencies = [
        ("links", "0011_merge_20260202_1055"),
    ]

    operations = [
        migrations.RunPython(
            remove_sqlite_faq_reference,
            restore_sqlite_faq_reference,
        ),
    ]
