Partner emails are stored with inconsistent casing (e.g., 'Alice@Example.COM' vs 'alice@example.com'), which breaks duplicate detection and causes the same organization to appear multiple times in the system.
Two parts to this fix:
Part 1 — Migration:
Write a database migration (using Drizzle migrate) that lowercases all existing partner.email values in place. The migration must be idempotent (safe to run twice).
Part 2 — Validation: Add normalization at the input layer so new and updated partner records always save emails in lowercase:
.toLowerCase() transform on the email fieldCHECK (email = lower(email))Write tests that confirm:
No contributions yet.