"""Schema changes for the email normalisation / TTL / cap work. - `Submission.canonical_email`: new indexed column populated by `Submission.save()`. Used to count active submissions per email for the 10-cap, and to look up the `VerifiedEmail` trust list. - `VerifiedEmail.verified_at` -> `validated_at`: keeps the data, drops the `auto_now_add` so `update_or_create` can roll the timestamp forward on every re-confirmation (rolling 30-day TTL). - `VerifiedEmail.updated_at`: removed -- `validated_at` IS the most recent confirmation timestamp now, no need for a second column. The data backfill (populate canonical_email, re-normalise existing VerifiedEmail rows) lives in 0005_normalize_existing_data so this migration stays a clean schema-only change. """ import django.utils.timezone from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("submissions", "0003_backfill_verified_emails"), ] operations = [ migrations.AddField( model_name="submission", name="canonical_email", field=models.EmailField(blank=True, db_index=True, max_length=254), ), migrations.RenameField( model_name="verifiedemail", old_name="verified_at", new_name="validated_at", ), migrations.RemoveField( model_name="verifiedemail", name="updated_at", ), migrations.AlterField( model_name="verifiedemail", name="validated_at", field=models.DateTimeField(default=django.utils.timezone.now), ), migrations.AlterModelOptions( name="verifiedemail", options={"ordering": ("-validated_at",)}, ), ]