# Generated by Django 4.2.28 on 2026-02-27 13:18

from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('payment_infra', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentWebhookLog',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('event', models.CharField(max_length=100)),
                ('invoice_code', models.CharField(blank=True, max_length=100, null=True)),
                ('reference', models.CharField(blank=True, max_length=100, null=True)),
                ('subscription_code', models.CharField(blank=True, max_length=100, null=True)),
                ('received_at', models.DateTimeField(auto_now_add=True)),
                ('payload', models.JSONField()),
                ('valid_signature', models.BooleanField(default=False)),
                ('processed', models.BooleanField(default=False)),
                ('extra_info', models.CharField(blank=True, default=None, max_length=255, null=True)),
            ],
        ),
        migrations.RemoveIndex(
            model_name='idempotencykey',
            name='payment_inf_status_43eb05_idx',
        ),
        migrations.RemoveIndex(
            model_name='payment',
            name='payment_inf_status_e35cf2_idx',
        ),
        migrations.AddIndex(
            model_name='idempotencykey',
            index=models.Index(fields=['status', 'key'], name='payment_inf_status_b49b2e_idx'),
        ),
        migrations.AddIndex(
            model_name='payment',
            index=models.Index(fields=['status', 'created_at', 'idempotency_key', 'email'], name='payment_inf_status_316622_idx'),
        ),
        migrations.AddConstraint(
            model_name='paymentwebhooklog',
            constraint=models.UniqueConstraint(fields=('event', 'reference'), name='unique_webhook_event_reference'),
        ),
    ]
