lucasp
lucasp
Explore posts from servers
DTDrizzle Team
Created by lucasp on 12/12/2024 in #help
im getting problems with drizzle schemas
ty for answer, @Yeaba_12 how i should export my schemas?
9 replies
CDCloudflare Developers
Created by lucasp on 11/30/2024 in #d1-database
yes i did this query
Yes I know, but I wouldn't think it would be that much, it's double and it seems too much for my taste.
10 replies
CDCloudflare Developers
Created by lucasp on 11/30/2024 in #d1-database
yes i did this query
do you recomend to use drizzle instead of prisma? is more faster?
10 replies
CDCloudflare Developers
Created by lucasp on 11/30/2024 in #d1-database
yes i did this query
yep
10 replies
CDCloudflare Developers
Created by lucasp on 11/30/2024 in #d1-database
yes i did this query
const countQuery = `
SELECT COUNT(*) as total_records
FROM user u
${whereClause}
`

const usersQuery = `
SELECT
u.id,
u.first_name,
u.last_name,
u.email,
u.created_at,
r.name as role_name,
t.phone as transportist_phone,
t.status as transportist_status,
cg.phone as cargo_giver_phone,
cg.status as cargo_giver_status
FROM user u
LEFT JOIN role r ON u.role_id = r.id
LEFT JOIN transportist t ON u.id = t.user_id
LEFT JOIN cargo_giver cg ON u.id = cg.user_id
${whereClause}
${orderByClause}
${limitClause}
${offsetClause}
`

const [countResult, usersResult] = await Promise.all([
prisma.$queryRaw<{ total_records: number }[]>`${Prisma.raw(countQuery)}`,
prisma.$queryRaw<[]>`${Prisma.raw(usersQuery)}`
])
const countQuery = `
SELECT COUNT(*) as total_records
FROM user u
${whereClause}
`

const usersQuery = `
SELECT
u.id,
u.first_name,
u.last_name,
u.email,
u.created_at,
r.name as role_name,
t.phone as transportist_phone,
t.status as transportist_status,
cg.phone as cargo_giver_phone,
cg.status as cargo_giver_status
FROM user u
LEFT JOIN role r ON u.role_id = r.id
LEFT JOIN transportist t ON u.id = t.user_id
LEFT JOIN cargo_giver cg ON u.id = cg.user_id
${whereClause}
${orderByClause}
${limitClause}
${offsetClause}
`

const [countResult, usersResult] = await Promise.all([
prisma.$queryRaw<{ total_records: number }[]>`${Prisma.raw(countQuery)}`,
prisma.$queryRaw<[]>`${Prisma.raw(usersQuery)}`
])
10 replies
CDCloudflare Developers
Created by lucasp on 9/26/2024 in #workers-help
any way to use the binding with hono without passing the service url?
ty dude!
8 replies
CDCloudflare Developers
Created by lucasp on 9/26/2024 in #workers-help
any way to use the binding with hono without passing the service url?
I got it and it worked! :O. Will it work the same in production???
8 replies
CDCloudflare Developers
Created by lucasp on 9/26/2024 in #workers-help
any way to use the binding with hono without passing the service url?
Yes, but I wanted to know if I should do it without putting the URL, since I have several workers and this would save me from having one more variable.
8 replies
CDCloudflare Developers
Created by lucasp on 9/2/2024 in #workers-help
problem with d1 locally
Yes, I was reading about that but it doesn't say how to specify the local db in the other worker. https://developers.cloudflare.com/d1/build-with-d1/local-development/#persist-data i've added this in both projects but when i run migrations this run over .wrangler/state.../d1 .sqlite
js
"dev": "wrangler dev src/index.ts --persist-to ./home/lucas/Desktop/workers-test",
js
"dev": "wrangler dev src/index.ts --persist-to ./home/lucas/Desktop/workers-test",
3 replies