anrunt
anrunt
DTDrizzle Team
Created by anrunt on 5/19/2024 in #help
Json update
Hello, as said in the title I want to update my json column, the code for it:
export const linksTable = pgTable("userLinks", {
id: text("id").primaryKey(),
userId: text("user_id").notNull().references(() => userTable.id),
links_json: json('user_links').$type<{userLinks: {
link1: string,
link2: string,
link3: string
}}>()
});
export const linksTable = pgTable("userLinks", {
id: text("id").primaryKey(),
userId: text("user_id").notNull().references(() => userTable.id),
links_json: json('user_links').$type<{userLinks: {
link1: string,
link2: string,
link3: string
}}>()
});
I want to update only link1, but when i try to do that I get error telling me that i have to update the whole json so link1,link2,link3. Is there any way to update only link1? Do updating all links will hit my db performance at all?
1 replies