# Generated by Django 4.2.4 on 2023-08-28 08:57

from django.db import migrations, models, connection


def forwards_func(apps, schema_editor):
    from django_project_base.notifications.models import DjangoProjectBaseNotification

    if list(
        filter(
            lambda g: getattr(g, "column", "") in ("project", "project_id"),
            DjangoProjectBaseNotification._meta.get_fields(),
        )
    ):
        try:
            with connection.cursor() as cursor:
                cursor.execute("ALTER TABLE notifications_djangoprojectbasenotification drop column project_id;")
        except Exception:
            pass


def reverse_func(apps, schema_editor):
    pass


class Migration(migrations.Migration):
    dependencies = [
        ("notifications", "0001_initial"),
    ]

    operations = [
        migrations.RunPython(forwards_func, reverse_func),
        migrations.AddField(
            model_name="djangoprojectbasenotification",
            name="project_slug",
            field=models.CharField(blank=True, max_length=1024, null=True),
        ),
    ]
