PhoenixKit.Migrations.Postgres.V196 (phoenix_kit v2.29.1)

Copy Markdown View Source

V196: a user's Google address.

Adds google_email to phoenix_kit_users. Sharing something with a user through Google (a Drive file, a calendar invite) needs the address their Google account actually answers to, which is not always the address they registered with.

The column is nullable and unconstrained: a Google address is optional, several users may legitimately share one (a team inbox), and nothing authenticates against it — email stays the identity.

The up also backfills it from phoenix_kit_user_oauth_providers: a user who has linked a Google sign-in already proved that address to us, so their column starts filled rather than waiting for their next sign-in. Only rows whose provider_email is present are copied, and only where google_email is still NULL, so the backfill is re-runnable and never overwrites a hand-entered value. A user with more than one Google link (the table allows one row per provider per user, but a repaired install may carry duplicates) takes the most recently updated one.

Additive only; re-runnable.

Summary

Functions

Rolls V196 back: drops the column. Hand-entered addresses are lost; linked Google accounts are untouched.

Functions

down(opts)

Rolls V196 back: drops the column. Hand-entered addresses are lost; linked Google accounts are untouched.

up(opts)