V191: who added a user.
Adds phoenix_kit_users.created_by_uuid uuid NULL — the account that
created this user by hand from the admin panel. NULL means the user
signed themselves up (registration form, magic link, OAuth, guest
checkout), or was added before this column existed and left no trace.
- Foreign key,
ON DELETE SET NULL— the same shape asorganization_uuid. Deleting the admin who added someone must not delete, or block deleting, the people they added. - Index —
ON DELETE SET NULLmakes Postgres look up every row pointing at a deleted user; without one that is a full scan ofphoenix_kit_usersper user deletion. - Backfill — the admin form has logged a
user.createdactivity withmetadata.method = 'manual'and the creating admin asactor_uuidsince the Activity feed shipped. Those entries seed the column, so users added before this version still show who added them — as far back asactivity_retention_dayskept the entry. Only an actor that still exists is copied, and a value already present is never overwritten, so the statement is safe to re-run.
The column is written only by PhoenixKit.Users.Auth.admin_create_user/2
and is never cast from params: a public registration form cannot claim to
have been added by someone.
Summary
Functions
Rolls V191 back: drops the column (its index and foreign key go with it).