AndréLB
AndréLB
DTDrizzle Team
Created by AndréLB on 8/17/2024 in #help
Joins with results in arrays
Isn't that just limiting it to one?
139 replies
DTDrizzle Team
Created by AndréLB on 8/17/2024 in #help
Joins with results in arrays
So if anyone could help me with the question that I posted: How do I do this in one select:
const fetchedOrderServices = await tx
.select()
.from(orderServices)
.where(eq(orderServices.orderID, order))

const fetchedOrderLocalServices = await tx
.select()
.from(orderLocalServices)
.where(eq(orderLocalServices.orderID, order))

const [fetchedOrder] = await tx
.select()
.from(orders)
.where(eq(orders.orderID, order))
.leftJoin(rentCarBookings, eq(rentCarBookings.orderID, order))
const fetchedOrderServices = await tx
.select()
.from(orderServices)
.where(eq(orderServices.orderID, order))

const fetchedOrderLocalServices = await tx
.select()
.from(orderLocalServices)
.where(eq(orderLocalServices.orderID, order))

const [fetchedOrder] = await tx
.select()
.from(orders)
.where(eq(orders.orderID, order))
.leftJoin(rentCarBookings, eq(rentCarBookings.orderID, order))
139 replies
DTDrizzle Team
Created by AndréLB on 8/17/2024 in #help
Joins with results in arrays
So is there a way of doing it with the select-syntax or do I have to use query syntax? I have used select everywhere else in the program so I prefer sticking to it?
139 replies
DTDrizzle Team
Created by AndréLB on 7/17/2024 in #help
Update with array of objects
Thanks! That worked!
4 replies
DTDrizzle Team
Created by TJ on 7/17/2024 in #help
Error handling
Pretty much what I am doing except I have a function in the catch block which I reuse. Move the if-else to a separate function that can be reused and you should be good to go.
3 replies
DTDrizzle Team
Created by DustyShowbiz on 5/12/2024 in #help
Error when creating migration
I think I have figured it out. The imports don't work with a .js extension. However, I need .js to run the files. Is there some way of fixing this that doesn't involve updating dozens of imports each time I migrante?
6 replies
DTDrizzle Team
Created by DustyShowbiz on 5/12/2024 in #help
Error when creating migration
I have that. The other files work but not that one. compiling works, just not generate. Error: Cannot find module '../services/userService.js' Require stack: - /home/andre/Documents/code/censored/src/schema/schema.ts - /home/andre/Documents/code/censored/node_modules/drizzle-kit/bin.cjs at Module._resolveFilename (node:internal/modules/cjs/loader:1142:15) at Module._resolveFilename (/home/andre/Documents/code/censored/node_modules/drizzle-kit/bin.cjs:14249:40) at Module._load (node:internal/modules/cjs/loader:983:27) at Module.require (node:internal/modules/cjs/loader:1230:19) at require (node:internal/modules/helpers:179:18) at Object.<anonymous> (/home/andre/Documents/code/censored/src/schema/schema.ts:14:8) at Module._compile (node:internal/modules/cjs/loader:1368:14) at Module._compile (/home/andre/Documents/code/censored/node_modules/drizzle-kit/bin.cjs:11751:31) at Module._extensions..js (node:internal/modules/cjs/loader:1426:10) at Object.newLoader [as .ts] (/home/andre/Documents/code/censored/node_modules/drizzle-kit/bin.cjs:11755:13) { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/andre/Documents/code/censored/src/schema/schema.ts', '/home/andre/Documents/code/censored/node_modules/drizzle-kit/bin.cjs' ] }
6 replies
DTDrizzle Team
Created by DustyShowbiz on 5/12/2024 in #help
Error when creating migration
Did you manage to find a solution?
6 replies
DTDrizzle Team
Created by DustyShowbiz on 5/12/2024 in #help
Error when creating migration
No help, however I have a similar problem. I am trying to import type definitions into my schema file and I am getting the same error.
6 replies