Icemourne
Icemourne
DTDrizzle Team
Created by Lostra on 3/13/2024 in #help
"onConflictDoUpdate" fails with error in Array.flatMap
you can do it with some raw sql
set: {
columnName: sql`excluded.columnName`,
},
set: {
columnName: sql`excluded.columnName`,
},
this is for postgres probably would be similar/same on others had same problem
4 replies
DTDrizzle Team
Created by puffy_tugboat on 3/14/2024 in #help
Raw sql in schema
if you pass raw sql string it kind of defeats purpose of having drizzle in the first place
5 replies
DTDrizzle Team
Created by puffy_tugboat on 3/14/2024 in #help
Raw sql in schema
why not make table how it should be id: uuid('id').notNull().references(() => auth.users, { onDelete: 'cascade'})
5 replies
DTDrizzle Team
Created by Icemourne on 3/11/2024 in #help
Can someone explain how can I use .onConflictDoUpdate with array of values?
incase someone has same problem I fixed like this
await db.insert(users)
.values([{ id: 1, name: 'Dan' }, { id: 2, name: 'Tom' }, { id: 3, name: 'Martin' }])
.onConflictDoUpdate({
target: users.id,
set: {
name: sql`excluded.name`
}
});
await db.insert(users)
.values([{ id: 1, name: 'Dan' }, { id: 2, name: 'Tom' }, { id: 3, name: 'Martin' }])
.onConflictDoUpdate({
target: users.id,
set: {
name: sql`excluded.name`
}
});
5 replies
DTDrizzle Team
Created by Smileyface on 3/11/2024 in #help
Property notNull does not exist on type 'PgEnum<[google, github]>
and that enum is then referenced in tables column
6 replies
DTDrizzle Team
Created by Smileyface on 3/11/2024 in #help
Property notNull does not exist on type 'PgEnum<[google, github]>
It has to create enum in DB separately that why provider fn is exported
6 replies
DTDrizzle Team
Created by Smileyface on 3/11/2024 in #help
Property notNull does not exist on type 'PgEnum<[google, github]>
This is correct usage
export const provider = pgEnum("providerEnum", ...)
{
...,
provider: provider("provider").notNull(),
...
}
export const provider = pgEnum("providerEnum", ...)
{
...,
provider: provider("provider").notNull(),
...
}
6 replies
DTDrizzle Team
Created by Icemourne on 3/8/2024 in #help
How can I make reusable columns then building schema?
that's great solution thx
3 replies