Revan
Revan
DTDrizzle Team
Created by JT on 4/9/2023 in #help
Iterator for result set
the new function signature is
export async function* queryToAsyncIterable
<
TQuery extends {
limit: (limit: number) => {
offset: (offset: number) => {
execute: () => Promise<TRow[]>
}
}
},
TRow,
>(query: TQuery, limit = 64): AsyncIterable<TRow>
export async function* queryToAsyncIterable
<
TQuery extends {
limit: (limit: number) => {
offset: (offset: number) => {
execute: () => Promise<TRow[]>
}
}
},
TRow,
>(query: TQuery, limit = 64): AsyncIterable<TRow>
10 replies
DTDrizzle Team
Created by JT on 4/9/2023 in #help
Iterator for result set
drizzle updated the types system since I wrote this function, I didnt have time to properly inspect the new drizzle types so I rewrote the function signature to just use structural types style
10 replies
DTDrizzle Team
Created by yousuf4you on 3/24/2024 in #help
Why returning not support in MySQL2??
yes because mysql doesnt support returning
4 replies
CDCloudflare Developers
Created by Cory on 2/12/2024 in #workers-help
When running fetch to transform an image, it ignoring the "format" but only within my code
wait this isnt the svelte discord
6 replies
CDCloudflare Developers
Created by Cory on 2/12/2024 in #workers-help
When running fetch to transform an image, it ignoring the "format" but only within my code
what are your accept headers
6 replies
DTDrizzle Team
Created by babakfp on 1/22/2024 in #help
What should I put inside `dbCredentials`? I'm using a local `.db` file with `better-sqlite3`
url: "database.sqlite"
8 replies
DTDrizzle Team
Created by arafays on 11/28/2023 in #help
SQL noob trying to make schema Drizzle ORM
@arafays So the problem here is your foreign keys are the wrong way around. In SQL, if a manager controls many brands, then the relationship needs to go on the brand table, right now you have it on the manager table as brandId, but if that were the case a manager could only control 1 brand, so instead put managerId on the brand table, and then to get the brands for a manager you can query every brand that has the managerId of <id> (hope this makes sense) When using drizzle you need to declare relationships twice, once for the database (like .references(() => managers.id)) and once to tell drizzle (with relations objects). From your stack overflow post,I can see you are getting the error: Error: There is not enough information to infer relation "__public__.managers.brands" This usually means that a relationship only has 1 half of the required objects, to declare managers+brands you need to have managersRelations AND brandsRelations:
export const managersRelations = relations(managers, ({many}) => {
brands: many(brands)
})

export const brandsRelations = relations(brands, ({one) => {
manager: one(managers, { fields: [brands.managerId], references: [managers.id] })
})
export const managersRelations = relations(managers, ({many}) => {
brands: many(brands)
})

export const brandsRelations = relations(brands, ({one) => {
manager: one(managers, { fields: [brands.managerId], references: [managers.id] })
})
10 replies
DTDrizzle Team
Created by roccho on 11/23/2023 in #help
In memory feature, drissle has?
drizzle is not a database itself, just the code for interacting with a database
5 replies
DTDrizzle Team
Created by roccho on 11/23/2023 in #help
In memory feature, drissle has?
better-sqlite3
5 replies
DTDrizzle Team
Created by roccho on 11/23/2023 in #help
In memory feature, drissle has?
const sqlite = new Database(':memory:'); it is
5 replies
DTDrizzle Team
Created by itsanameidk on 11/10/2023 in #help
Generate Random UUID Sqlite
I would assume no because the randomuuid function is part of the nodejs code, maybe there is a polyfill for node libraries for react native, or react native could have its own cryptography module that you could use
10 replies
DTDrizzle Team
Created by itsanameidk on 11/10/2023 in #help
Generate Random UUID Sqlite
no
10 replies
DTDrizzle Team
Created by itsanameidk on 11/10/2023 in #help
Generate Random UUID Sqlite
I dont believe sqlite has uuid generating functionality built in
10 replies
DTDrizzle Team
Created by itsanameidk on 11/10/2023 in #help
Generate Random UUID Sqlite
I use nodejs randomuuid:
id: text("id", { length: 36 }).primaryKey().$defaultFn(() => randomUUID()),
id: text("id", { length: 36 }).primaryKey().$defaultFn(() => randomUUID()),
10 replies
DTDrizzle Team
Created by francel on 10/30/2023 in #help
yesterday, I tried to migrate from prisma to drizzle, but ultimately, I went back to prisma
it works for me
2 replies
DTDrizzle Team
Created by Pioter on 10/23/2023 in #help
Next 13, Next-Auth with Neon Postgres and Drizzle vs Prisma 5
what if you try removing the where clause
27 replies