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: join field works on collections with versions enabled #8715

Open
wants to merge 6 commits into
base: beta
Choose a base branch
from

Conversation

r1tsuu
Copy link
Collaborator

@r1tsuu r1tsuu commented Oct 15, 2024

@r1tsuu r1tsuu force-pushed the fix/join-field-does-not-work-when-versions-are-enabled-this-branch-should-fix-that branch from f5bdb79 to 44d578e Compare October 21, 2024 13:47
@r1tsuu r1tsuu force-pushed the fix/join-field-does-not-work-when-versions-are-enabled-this-branch-should-fix-that branch from b5533f0 to 9434429 Compare October 21, 2024 17:12
@r1tsuu r1tsuu marked this pull request as ready for review October 21, 2024 17:13
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

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

Looks good, just a few small open questions. This might be good to merge as-is, but I'd like to get your thoughts first.

@@ -74,6 +74,7 @@ export const init: Init = async function init(this: BasePostgresAdapter) {
disableNotNull: !!collection.versions?.drafts,
disableUnique: true,
fields: versionFields,
joins: collection.joins,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this being used any longer since you deleted the case 'join' field in traverseFields?

@@ -936,30 +936,6 @@ export const traverseFields = ({

break

case 'join': {
Copy link
Contributor

Choose a reason for hiding this comment

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

Even if we are not using the relationship any more, I'm wondering if it isn't good to keep just for somebody who might want to do their own drizzle queries later.

Copy link
Collaborator Author

@r1tsuu r1tsuu Oct 21, 2024

Choose a reason for hiding this comment

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

Since we have the afterSchemaInit thing (which includes schema.relationships), they can add their relationships there as they would like. I also feel like we should have some nice drizzle types generation, as for now it's not easy to use those.

Currently, even with using the introspection feature, relationships won't appear because those aren't defined in the database, not sure how we can solve this nicely

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants