zahdonk
DTDrizzle Team
•Created by zahdonk on 9/18/2023 in #help
How to join tables from different dbs in same db cluster?
Is there a way to explicitly declare which db/table-combination we want to join?
4 replies
DTDrizzle Team
•Created by zahdonk on 9/18/2023 in #help
How to join tables from different dbs in same db cluster?
relations were defined like this:
const tableBRelations = relations(tableB, ({many}) => ({
tableAThings: many(tableA)
}))
and
const tableARelations = relations(tableA,
({one}) => ({
tableBThing: one(tableB, {
fields: [tableA.tableBReferenceId],
references: [tableB.id]
})
}))
4 replies
DTDrizzle Team
•Created by zahdonk on 9/18/2023 in #help
How to join tables from different dbs in same db cluster?
Something like this:
import { tableA } from "db/db1/schema";
import { tableB } from "db/db2/schema";
const result = db1.select().from(tableA).leftJoin(tableB, eq(tableA.id, tableB.tableAId))
leads to an error like Table 'db1.tableB' doesn't exist.
Although intellisense gets the types right.
4 replies