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

Use native DB type in injected auth models if user uses it #2243

Merged
merged 5 commits into from
Sep 3, 2024

Conversation

infomiho
Copy link
Contributor

Closes #2167

@infomiho infomiho requested a review from sodic August 22, 2024 14:16
@infomiho infomiho force-pushed the miho-user-id-native-db-type branch 2 times, most recently from aafbb7a to d08e324 Compare August 23, 2024 09:44

-- | @db.Uuid or @db.String or @db.VarChar are examples of native db types.
isNativeDbTypeAttr :: Attribute -> Bool
isNativeDbTypeAttr = isPrefixOf "db." . _attrName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isNativeDbTypeAttr = isPrefixOf "db." . _attrName
isNativeDbTypeAttr = ("db." `isPrefixOf`) . _attrName

reads nicer :D

Copy link
Member

@Martinsos Martinsos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@infomiho nice stuff! I approved it, but check the comment about possibly making the test more readable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of AST here which is a bit hard to read / maintain -> any way we might be able to replace it with actual PSL, here in the test? That is parsed either during test runtime, or even test compile time if that is doable (although I think I remember we had hard time with that).
If not, never mind, but if yes, I think it could make the test easier to read and maintain.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is parsed either during test runtime

I've done this bit since it was similar to something we already did with the full schema file.

getPrismaSchema :: T.Text -> Psl.Schema.Schema

@infomiho infomiho merged commit 0b90709 into main Sep 3, 2024
6 checks passed
@infomiho infomiho deleted the miho-user-id-native-db-type branch September 3, 2024 08:10
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.

Using native DB fields for User id is not supported when using Wasp auth
2 participants