join(),find() error within transaction when no fkey defined
I have 2 tables, customers
and details
. details
has a nullable customer_id
column, but no foreign key is defined (legacy, not an option for now).
The following code fails:
database.withTransaction((tx) => tx.customers.join({ details: {
relation: 'details',
type: 'INNER',
on: { customer_id: 'id' },
decomposeTo: 'object',
}}).find(1))
The error is from lib/util/parse-keys.js:142
, const matched = source.joins.some(j => {
source.joins is undefined
Running the same code without transaction works as expected, e.g.:
database.customers.join({ details: {
relation: 'details',
type: 'INNER',
on: { customer_id: 'id' },
decomposeTo: 'object',
}}).find(1))
Creating the foreign key (possible on test data) and running the same code also fixes the problem.
I can take the time to create a minimal repro if needed, let me know.