Simplifying process and state of user reg db
- Separate
users table into two tables
-
users: holds information about the user
- username, uid, gid, email, reason, fullname
-
process: holds information about the account creation process for debugging
- create_account, git_commit, dir_verify, subscribe_mail_list, notify_user, sent, reported, queuename, count
- Eliminate the column
last_update from users table. The represented value exists in states table. For a given user, it is the state in the row with most recent date. If the states table is indexed by user and sorted by time, this record can be retrieved in O(1) time.
- Add
reason column to states table. This will allow for an arbitrary reason to be stored with the event. Other tooling can be enhanced to make use of this column.
- Add
method column to states table. This will record the method used to enact the state change. For now this could be automated (for rabbitmq) and manual (for CLI). These could be made more fine-grained in the future.
- Rename
states to events to more accurately represent the data. This could pave the way to using a states enum table to constrain what values are in the states column.
- Modify the account creation tasks to accommodate the changes above. Use the reason "__account_creation".
- Add the historic account creation dates to the events table.
- State should be
hold to minimize risk, maximize security. Worst case, we accidentally set ana active user to hold, they contact us, we fix.
- Reason should be "__account_creation"
- Method should be "manual"