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

Chore: upgrade prisma #1190

Merged
merged 3 commits into from
May 25, 2023
Merged

Chore: upgrade prisma #1190

merged 3 commits into from
May 25, 2023

Conversation

mipyykko
Copy link
Collaborator

Finally give in and upgrade Prisma to a modern version, hopping right from 2.x to 4.x. This called for replacing the deprecated nexus-plugin-prisma with a forked version, but the changes there have been relatively minor.

Main Prisma-related refactors in this PR are mainly just to rename the primary/foreign/unique keys and indexes to use the new default convention. Prisma schema is rewritten using the introspection feature, although some manual changes are still needed -- now the Postgres Decimal columns would be automatically cast to Decimal.js objects, which would just break things, so I force them to be Float as before.

Now that Prisma can be upgraded, we should also use its new features -- for example transactions are useful. Also, previously Prisma did not cascade delete even if the DB schema was set up to do so, but now it does.

@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Merging #1190 (a1eadc8) into master (a9a548f) will decrease coverage by 0.27%.
The diff coverage is 34.86%.

@@            Coverage Diff             @@
##           master    #1190      +/-   ##
==========================================
- Coverage   65.51%   65.24%   -0.27%     
==========================================
  Files         124      124              
  Lines        5222     5280      +58     
  Branches     1160     1225      +65     
==========================================
+ Hits         3421     3445      +24     
- Misses       1677     1711      +34     
  Partials      124      124              
Flag Coverage Δ
backend 65.24% <34.86%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
backend/api/routes/completions.ts 58.02% <0.00%> (-0.37%) ⬇️
backend/api/routes/progress.ts 30.85% <0.00%> (-0.91%) ⬇️
...nsumer/common/userCourseProgress/BAI/completion.ts 14.28% <0.00%> (-0.43%) ⬇️
backend/graphql/Completion/model.ts 40.24% <0.00%> (-0.50%) ⬇️
backend/graphql/Completion/queries.ts 24.52% <0.00%> (-1.48%) ⬇️
backend/graphql/StudyModule/model.ts 55.55% <0.00%> (-2.14%) ⬇️
backend/graphql/Tag.ts 41.46% <0.00%> (-0.34%) ⬇️
backend/graphql/User/model.ts 35.75% <0.00%> (-0.89%) ⬇️
backend/graphql/UserCourseProgress.ts 30.25% <0.00%> (-0.26%) ⬇️
backend/graphql/UserCourseServiceProgress.ts 49.05% <0.00%> (ø)
... and 13 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mipyykko mipyykko merged commit b840fe3 into master May 25, 2023
@mipyykko mipyykko deleted the chore-upgrade-prisma branch May 25, 2023 09:02
mipyykko added a commit that referenced this pull request May 25, 2023
mipyykko added a commit that referenced this pull request May 25, 2023
Revert "Chore: upgrade prisma (#1190)"

This reverts commit b840fe3.
@mipyykko mipyykko restored the chore-upgrade-prisma branch May 25, 2023 09:08
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

Successfully merging this pull request may close these issues.

1 participant