use zauth id's so usernames can be updated (and use zpi for profile images!)#220
use zauth id's so usernames can be updated (and use zpi for profile images!)#220
Conversation
| end | ||
|
|
||
| # overwrite name (for if name changed) | ||
| db_user.name = auth.uid |
There was a problem hiding this comment.
An alternative here would be to just take some downtime and do a migration where we prepare a mapping of usernames to ZAuth id's, and fill them in the database. That way, the whole table will be filled, we can make the zauth_id a non-nullable column, and there's no need for changes like these in code.
| @@ -0,0 +1,5 @@ | |||
| class AddZauthIdToUsers < ActiveRecord::Migration[6.1] | |||
| def change | |||
| add_column :users, :zauth_id, :integer | |||
There was a problem hiding this comment.
Since we're finding by zauth_id, having an index here would be nice. Together with https://github.com/ZeusWPI/Tap/pull/220/changes#r2622094045, we could even make this non nullable after doing the migration.
| @@ -0,0 +1,5 @@ | |||
| class AddZauthIdToUsers < ActiveRecord::Migration[6.1] | |||
| def change | |||
| add_column :users, :zauth_id, :integer | |||
There was a problem hiding this comment.
Should this get a unique constraint? Having two users with the same id would be strange and should throw some error.
|
↑ Rebased on master, re-creating the migrations. |
|
we will deploy this now, fill the column with the zauthids and then make the not null in a future PR |
closes #216
this is the first step in using zauth id's for syncing transactions as well