You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cleanup props on User Schema and DB records for a User #50344
Not set this anywhere except to null in User.confirm which is never directly called
badges
Not currently used. Do we plan to?
rand
Do we need this?
Transformation Strategy
We have concluded an initial (needed) normalization will involve transforming optional array types into [].
completedChallenges.files is an array type, but does not exist on every completed challenge. Do we want to add files: [] to every single completedChallenges element? If not, we will not be able to make use of strong typing using Prisma.
completedChallenges
remove all __<> properties
profileUI
remove all __<> properties
progressTimestamps
[{ timestamp: Double }] -> [Double]
[Null] -> []
[Int64] -> [Double]
partiallyCompletedChallenges
Undefined -> []
yearsTopContributor
Undefined -> []
[String] -> [Double]
A string of length 4 takes 24 bytes, a double takes 8 bytes
I ran the script locally and it took ~20 minutes on 8 threads. Obviously, this is almost meaningless (being on just my machine), but it does show that this is not the type of thing to take hours/days.
After searching through the local DB, it looks like what was meant to be done was done.
Do you have the specs for the machine you run this on? How many CPUS, total memory?
Yes, but I do not think it is remotely comparable. As discussed, we should go with a staging test. Then, the only thing we need to decide is what machine runs the script.
@ShaunSHamilton based on our recent discussions, I think we're likely to do this after deploying the new api. As such, I'm moving it to Post-MVP. Please move it back if I've misunderstood.
Activity
ShaunSHamilton commentedon May 10, 2023
Fields to Remove
githubisGithubisLinkedInisTwitterisWebsitepasswordtimezoneverificationTokennullinUser.confirmwhich is never directly calledbadgesrandTransformation Strategy
We have concluded an initial (needed) normalization will involve transforming optional array types into
[].completedChallenges.filesis an array type, but does not exist on every completed challenge. Do we want to addfiles: []to every singlecompletedChallengeselement? If not, we will not be able to make use of strong typing using Prisma.completedChallenges__<>propertiesprofileUI__<>propertiesprogressTimestamps[{ timestamp: Double }]->[Double][Null]->[][Int64]->[Double]partiallyCompletedChallengesUndefined->[]yearsTopContributorUndefined->[][String]->[Double]savedChallengesUndefined->[]badgesUndefined->[]raisedadead commentedon May 10, 2023
The
is*flag seems to be present in the code, last I checked. Do you think removing has any impact?ShaunSHamilton commentedon May 10, 2023
Thank you for making me double-check. The
is<>fields are never used, but are still being set:freeCodeCamp/api-server/src/common/models/user.js
Lines 808 to 827 in b24c939
At one point, I assume they were used for logic on the client like:
Now, we just use:
freeCodeCamp/client/src/components/profile/components/social-icons.tsx
Line 90 in b24c939
ShaunSHamilton commentedon May 10, 2023
I ran the script locally and it took ~20 minutes on 8 threads. Obviously, this is almost meaningless (being on just my machine), but it does show that this is not the type of thing to take hours/days.
After searching through the local DB, it looks like what was meant to be done was done.
raisedadead commentedon May 10, 2023
Did you get a chance to profile the memory and CPU usage?
ShaunSHamilton commentedon May 10, 2023
Yes, but only from a whole-system perspective - I did not see an easy way to log MongoDB-specific usage other than
htop.mongodraisedadead commentedon May 11, 2023
Do you have the specs for the machine you run this on? How many CPUS, total memory? We could do a comparison test on MongoDB Cloud that way.
ShaunSHamilton commentedon May 11, 2023
Yes, but I do not think it is remotely comparable. As discussed, we should go with a staging test. Then, the only thing we need to decide is what machine runs the script.
naomi-lgbt commentedon May 15, 2023
I'd suggest spinning up a DigitalOcean droplet to run the script and destroying it once done.
ShaunSHamilton commentedon May 17, 2023
The normalization script is ready (for review at least).
Action Plan
moT01 commentedon Apr 30, 2024
Could we move this to post-mvp?
ojeytonwilliams commentedon Apr 30, 2024
It doesn't seem strictly necessary, so post-MVP seems best.
ojeytonwilliams commentedon Jun 12, 2024
@ShaunSHamilton based on our recent discussions, I think we're likely to do this after deploying the new api. As such, I'm moving it to Post-MVP. Please move it back if I've misunderstood.
ShaunSHamilton commentedon Jun 12, 2024
To prevent LB from adding back stuff we do not want, this should be Post MVP. Thanks, @ojeytonwilliams