Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support custom primary key in accounts table on MySQL
If one wants to use UUID primary keys on MySQL, one possibility is using a string column and generating UUIDs in Ruby. # table definition create_table :accounts do String :id, primary_key: true # ... end # rodauth configuration before_create_account do account[:id] = SecureRandom.uuid end However, Sequel's `#insert` appears to return `0` when the primary key is something other than an autoincrementing integer on MySQL. This causes Rodauth's `#save_account` to overwrite the generated UUID with `0` on the account hash, causing problems down the line in things like account verification. We fix this by having `#save_account` only set the `:id` if it hasn't already been set.
- Loading branch information