# Generated by Django 5.2.12 on 2026-04-09 18:04

from django.apps.registry import Apps
from django.db import migrations, models
from django.db.backends.base.schema import BaseDatabaseSchemaEditor


def migrate_blank_launch_url(apps: Apps, schema_editor: BaseDatabaseSchemaEditor):
    db_alias = schema_editor.connection.alias
    Application = apps.get_model("authentik_core", "Application")

    Application.objects.using(db_alias).filter(meta_launch_url="blank://blank").update(
        meta_hide=True, meta_launch_url=""
    )


class Migration(migrations.Migration):

    dependencies = [
        ("authentik_core", "0057_remove_user_groups_remove_user_user_permissions_and_more"),
    ]

    operations = [
        migrations.AddField(
            model_name="application",
            name="meta_hide",
            field=models.BooleanField(
                default=False, help_text="Hide this application from the user dashboard."
            ),
        ),
        migrations.RunPython(migrate_blank_launch_url, migrations.RunPython.noop),
    ]
