DT
Drizzle Team•9mo ago
RayDay

A way to use the update function with existing value in json blob column?

Hi there. I found this almost exact questions already asked but I don't get how I can do that. I have the following in SQLite using Turso db
export const someTable = sqliteTable("some", {
id:text("id").primaryKey().notNull(),
images: blob("images", { mode: "json" }).$type<string[]>().notNull(),
prompt: text("prompt"),
others: ...
});
export const someTable = sqliteTable("some", {
id:text("id").primaryKey().notNull(),
images: blob("images", { mode: "json" }).$type<string[]>().notNull(),
prompt: text("prompt"),
others: ...
});
What I would like to do is have a way for putting more images into blob. so basically an array where i push more inputs but in json I guess or is there a better suited type ?
3 Replies
RayDay
RayDayOP•9mo ago
I 'd really appreciate it if somebody would help me here
Dan
Dan•9mo ago
My guess is that you need to change mode to "buffer" and remove $type
RayDay
RayDayOP•9mo ago
na I changed it from blob to text and inserted a JSON.stringify([something]) when I get it back i parse it and push something to that array stringify it again and then push it again to db 🤷
Want results from more Discord servers?
Add your server