parabol icon indicating copy to clipboard operation
parabol copied to clipboard

chore: normalize data in PG across tables

Open mattkrick opened this issue 7 months ago • 1 comments

We've gotten into a pretty bad habit of denormalizing data across tables. This makes updates tricky because you have to update the field in multiple tables!

Here are some culprits I've found that we should remove. As we find more we should add them here & try really hard to have a single source of truth!

  • Organization.tier (truth)
  • User.tier
  • OrganizationUser.tier
  • Organization.trialStartDate (truth)
  • OrganizationUser.trialStartDate
  • Team.trialStartDate
  • User.trialStartDate (🫤 denormalized across 4 tables total?!)
  • User.picture (truth)
  • TeamMember.picture
  • User.preferredName (truth)
  • TeamMember.preferredName
  • User.inactive (truth)
  • Organization.inactive
  • Organization.isPaid (truth)
  • Team.isPaid
  • User.tms (TeamMember is truth)

AC

  • [ ] refactor setUserTierForUserIds, setUserTierForOrgId, setTierForOrgUsers

mattkrick avatar Jul 03 '24 23:07 mattkrick