# Generated by Django 3.2.18 on 2023-05-01 22:14

from django.db import migrations, models

_MYSQL = "mysql"


class AddIndexSkipMySQL(migrations.AddIndex):
    def database_forwards(self, app_label, schema_editor, from_state, to_state):
        if schema_editor.connection.vendor == _MYSQL:
            return
        super().database_forwards(
            app_label=app_label,
            schema_editor=schema_editor,
            from_state=from_state,
            to_state=to_state,
        )

    def database_backwards(self, app_label, schema_editor, from_state, to_state):
        if schema_editor.connection.vendor == _MYSQL:
            return
        super().database_forwards(
            app_label=app_label,
            schema_editor=schema_editor,
            from_state=from_state,
            to_state=to_state,
        )


class Migration(migrations.Migration):

    dependencies = [
        ("fcm_django", "0010_unique_registration_id"),
    ]

    operations = [
        AddIndexSkipMySQL(
            model_name="fcmdevice",
            index=models.Index(
                fields=["registration_id", "user"],
                name="fcm_django__registr_dacdb2_idx",
            ),
        ),
    ]
