enhancement
avatar mbabker
mbabker
8 Dec 2016

Users are inconsistently mapped/stored. We have a couple of tables which use our users table's PK for a foreign relation, and we have tables which store the username of the individual performing the activity. This is in part because we don't pull all users arbitrarily into our users table; only users who have ever logged into the site are there (this "limit" IMO isn't really necessary as we aren't storing any type of authentication data so aside from being able to track a last login date and set a couple of basic parameters, the table really has no special purpose when it relates to user registration).

We also don't store the GitHub user ID for users (something which if I'm not mistaken is available on all webhook payloads and API endpoints which respond with user data). This creates some "interesting" quirks because we have some folks who have multiple user records in our database now for various reasons (either authentication hiccuped and incorrectly inserted a new record or they changed their username and/or email).

User storage should be restructured so that:

  • the GitHub user ID is stored in the users table
  • any user who has performed an activity is stored in the users table
  • all tables use a proper FK to the users table

Note that this might require some manual cleanup of the database to de-duplicate records. I'll deal with that if/when we get to it.

avatar mbabker mbabker - open - 8 Dec 2016
avatar mbabker mbabker - change - 8 Dec 2016
Labels Added: enhancement
avatar mbabker mbabker - labeled - 8 Dec 2016

Add a Comment

Login with GitHub to post a comment