# Generated by Django 5.2.5 on 2025-10-05 10:01

from django.contrib.auth import get_user_model
from django.db import migrations

from bookmarks.models import Toast

User = get_user_model()


def forwards(apps, schema_editor):
    for user in User.objects.all():
        toast = Toast(
            key="new_search_toast",
            message="This version replaces the search engine with a new implementation that supports logical operators (and, or, not). If you run into any issues with the new search, you can switch back to the old one by enabling legacy search in the settings.",
            owner=user,
        )
        toast.save()


def reverse(apps, schema_editor):
    Toast.objects.filter(key="new_search_toast").delete()


class Migration(migrations.Migration):
    dependencies = [
        ("bookmarks", "0049_userprofile_legacy_search"),
    ]

    operations = [
        migrations.RunPython(forwards, reverse),
    ]
