# Generated by Django 4.2.19 on 2025-03-02 21:07

import uuid
from django.db import migrations, models

def generate_unique_hashes(apps, schema_editor):
    Customer = apps.get_model('customers', 'Customer')
    for customer in Customer.objects.all():
        customer.email_hash = uuid.uuid4().hex
        customer.save(update_fields=['email_hash'])

class Migration(migrations.Migration):

    dependencies = [
        ('customers', '0007_customerauth_blocked_customerauth_blocked_at_and_more'),
    ]

    operations = [
        migrations.AddField(
            model_name='customer',
            name='email_hash',
            field=models.CharField(db_index=True, max_length=64, unique=True, null=True),
        ),
        migrations.RunPython(generate_unique_hashes),
        migrations.AlterField(
            model_name='customer',
            name='email_hash',
            field=models.CharField(db_index=True, max_length=64, unique=True),
        ),
    ]
