File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
packages/drizzle/src/find Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ export const traverseFields = ({
513513 const subQueryAlias = `${ columnName } _subquery`
514514
515515 let sqlWhere = eq (
516- adapter . tables [ currentTableName ] . id ,
516+ sql . raw ( `" ${ currentTableName } "."id"` ) ,
517517 sql . raw ( `"${ subQueryAlias } "."${ onPath } "` ) ,
518518 )
519519
@@ -577,19 +577,23 @@ export const traverseFields = ({
577577
578578 let joinQueryWhere : Where
579579
580+ const currentIDRaw = sql . raw (
581+ `"${ getNameFromDrizzleTable ( currentIDColumn . table ) } "."${ currentIDColumn . name } "` ,
582+ )
583+
580584 if ( Array . isArray ( field . targetField . relationTo ) ) {
581585 joinQueryWhere = {
582586 [ field . on ] : {
583587 equals : {
584588 relationTo : collectionSlug ,
585- value : rawConstraint ( currentIDColumn ) ,
589+ value : rawConstraint ( currentIDRaw ) ,
586590 } ,
587591 } ,
588592 }
589593 } else {
590594 joinQueryWhere = {
591595 [ field . on ] : {
592- equals : rawConstraint ( currentIDColumn ) ,
596+ equals : rawConstraint ( currentIDRaw ) ,
593597 } ,
594598 }
595599 }
You can’t perform that action at this time.
0 commit comments