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

fix(client): Enum type clashes #20194

Merged
merged 4 commits into from
Jul 19, 2023
Merged

fix(client): Enum type clashes #20194

merged 4 commits into from
Jul 19, 2023

Conversation

SevInf
Copy link
Contributor

@SevInf SevInf commented Jul 12, 2023

Follow up to #20150.
Changes we did to extensions have fixed name clashes for models, but not
for enums. Enums problem is more complicated: in case of name clash, it
is impossible for contents of Prisma namespace to reference the value
from outer scope.
Solution is: all top-level enums are put into $Enums namespace. Types
within Prisma namespace always refer to them using fully-qualifed
name. Top-level enums are re-exported from $Enums namespace for
backward compatiblity.

Also, does opportunistic clean-ups/refactors

Fix #20031

@SevInf SevInf added this to the 5.1.0 milestone Jul 12, 2023
@codspeed-hq
Copy link

codspeed-hq bot commented Jul 12, 2023

CodSpeed Performance Report

Merging #20194 will degrade performances by 51.82%

Comparing fix/enum-type-clash (b4bf636) with main (99a96e8)

Summary

❌ 1 regressions
✅ 3 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main fix/enum-type-clash Change
typescript compilation ~50 Models 77.4 ms 160.6 ms -51.82%

@SevInf SevInf marked this pull request as ready for review July 13, 2023 09:38
@SevInf SevInf requested a review from a team as a code owner July 13, 2023 09:38
@SevInf SevInf requested review from aqrln and millsp and removed request for a team July 13, 2023 09:38
Follow up to #20150.
Changes we did to extensions have fixed name clashes for models, but not
for enums. Enums problem is more complicated: in case of name clash, it
is impossible for contents of `Prisma` namespace to reference the value
from outer scope.
Solution is: all top-level enums are put into $Enums namespace. Types
within `Prisma` namespace always refer to them using fully-qualifed
name. Top-level enums are re-exported from `$Enums` namespace for
backward compatiblity.

Also, does opportunistic clean-ups/refactors

Fix #20031
@SevInf SevInf merged commit 5cc1e19 into main Jul 19, 2023
60 of 63 checks passed
@SevInf SevInf deleted the fix/enum-type-clash branch July 19, 2023 16:19
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.

LogLevel enum conflicts with built-in Prisma type
2 participants