Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant columns from UserBase #10

Open
jace opened this issue Jul 2, 2013 · 1 comment
Open

Remove redundant columns from UserBase #10

jace opened this issue Jul 2, 2013 · 1 comment

Comments

@jace
Copy link
Member

jace commented Jul 2, 2013

The UserBase mixin introduces many fields with redundant data (full name, username, timezone, userinfo), all of which are also available from Lastuser. Usernames in particular even have unique constraints. Keeping this data in sync with Lastuser has been the cause of much grief over the past year. It was the primary motivation behind adding push notifications to Lastuser.

Which is a pity because this data is also almost never used. Funnel uses it to display names against proposals, but every other app uses the Profile object instead (or Channel or Workspace in some apps). Profiles aren't linked to a User object precisely because we didn't want any more grief from data being out of sync.

We should just drop all these redundant columns from UserBase. Since the data is still required from time to time, (a) the columns should be replaced with properties and (b) the properties should query Lastuser and cache the results.

Dropping columns will also make the User db model lighter, a point that is relevant given that our user count is growing and, the with the number of times we store this data across apps, data storage is growing exponentially.

Note that this cache potentially cannot be shared across apps as the data contained in each user record is dependent on the requested scope. This makes the cache somewhat less efficient and calls for us to consider compartmentalizing caching by scope -- the current userinfo fieldset isn't cleanly divided by scope.

@jace
Copy link
Member Author

jace commented Apr 19, 2014

The User model can't be completely discarded because the lastuser access token needs to be saved. However, the Team model is unnecessary. Other models can directly store the Team userid and this can be mapped to a non-persistent Team object via an SQLAlchemy instrumented attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant