You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
audit log creds [2/3]: convert audit log auth_method to an enum (#9655)
Built on #9654, which makes
the source data for this column an enum. This PR converts the column to
an enum. It's kind of alarming to do this migration, but the strings are
hard-coded in the repo so there's no way there could be anything else in
the DB.
This column being an enum makes it work more nicely as a type field for
the `credential_id` column added in
#9656.
### Summary of migrations
1. **up1**: Create the `audit_log_auth_method` enum type with values
`session_cookie`, `access_token`, `scim_token`, `spoof`
2. **up2**: Add a temporary column `auth_method_temp` of the new enum
type
3. **up3**: Copy data from the old string column to the temp column,
mapping `'token'` → `'access_token'` (the others map 1:1)
4. **up4**: Drop the `audit_log_complete` view (it depends on the column
being dropped)
5. **up5**: Drop the old string `auth_method` column
6. **up6**: Add a new `auth_method` column with the enum type
7. **up7**: Copy data from temp column to the new enum column
8. **up8**: Drop the temp column
9. **up9**: Drop the view again (defensive, in case it exists)
10. **up10**: Recreate `audit_log_complete` view with the new column
type
The temp column thing is necessary because you can't change a column's
type in place. The view must be dropped and recreated because it
references the column.
0 commit comments