chore: add support for efficient domain-based operations for User and SecondaryEmail #26397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR introduces a schema change to support efficient domain-based operations without relying on string parsing or in-memory user ID lists at query time.
Specifically, it:
This PR intentionally does not backfill existing rows to avoid long-running locks or table rewrites. Historical backfill and index creation will be handled separately.
Fixes #XXXX
Fixes CAL-XXXX
Visual Demo (For contributors especially)
N/A — database-only schema change with no UI or behavior changes exposed yet.
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?
This change is verified at the database level.
Manual verification steps:
Expected behavior:
New and updated rows correctly populate email_domain
Existing rows remain unchanged (email_domain = NULL)
No application-level logic is required to manage domain normalization
Environment variables: None
Minimal test data: A single user and secondary email record
Happy path: email = [email protected] → email_domain = domain.com
Checklist