CrisOG
Explore posts from serversDTDrizzle Team
•Created by CrisOG on 2/4/2024 in #help
sql.placeholder not working for pg array of strings
const create = db
.insert(eventTable)
.values({
title: sql.placeholder('title'),
images: sql.placeholder('images')
})
.returning()
.prepare('createEvent');
const create = db
.insert(eventTable)
.values({
title: sql.placeholder('title'),
images: sql.placeholder('images')
})
.returning()
.prepare('createEvent');
export const eventTable = pgTable('event', {
id: uuid('id').primaryKey().defaultRandom(),
title: text('title').notNull(),
images: text('images').array(),
createdAt: timestamp('createdAt').notNull().defaultNow(),
updatedAt: timestamp('updatedAt').notNull().defaultNow()
});
export const eventTable = pgTable('event', {
id: uuid('id').primaryKey().defaultRandom(),
title: text('title').notNull(),
images: text('images').array(),
createdAt: timestamp('createdAt').notNull().defaultNow(),
updatedAt: timestamp('updatedAt').notNull().defaultNow()
});
TypeError: value.map is not a function
at PgArray.mapToDriverValue (file:///project/node_modules/drizzle-orm/pg-core/columns/common.js:93:21)
at file:///project/node_modules/drizzle-orm/sql/sql.js:119:73
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:91:21
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:94:21
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:52:26
at Object.startActiveSpan (file:///project/node_modules/drizzle-orm/tracing.js:8:14)
at SQL.toQuery (file:///project/node_modules/drizzle-orm/sql/sql.js:51:19)
at PgDialect.sqlToQuery (file:///project/node_modules/drizzle-orm/pg-core/dialect.js:362:17)
at file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:124:53
at Object.startActiveSpan (file:///project/node_modules/drizzle-orm/tracing.js:8:14)
at QueryPromise._prepare (file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:123:19)
at QueryPromise.prepare (file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:128:17)
at /project/src/server/db/models/event.ts:17:4
at async instantiateModule (file:///project/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:50861:9)
TypeError: value.map is not a function
at PgArray.mapToDriverValue (file:///project/node_modules/drizzle-orm/pg-core/columns/common.js:93:21)
at file:///project/node_modules/drizzle-orm/sql/sql.js:119:73
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:91:21
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:94:21
at Array.map (<anonymous>)
at SQL.buildQueryFromSourceParams (file:///project/node_modules/drizzle-orm/sql/sql.js:72:32)
at file:///project/node_modules/drizzle-orm/sql/sql.js:52:26
at Object.startActiveSpan (file:///project/node_modules/drizzle-orm/tracing.js:8:14)
at SQL.toQuery (file:///project/node_modules/drizzle-orm/sql/sql.js:51:19)
at PgDialect.sqlToQuery (file:///project/node_modules/drizzle-orm/pg-core/dialect.js:362:17)
at file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:124:53
at Object.startActiveSpan (file:///project/node_modules/drizzle-orm/tracing.js:8:14)
at QueryPromise._prepare (file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:123:19)
at QueryPromise.prepare (file:///project/node_modules/drizzle-orm/pg-core/query-builders/insert.js:128:17)
at /project/src/server/db/models/event.ts:17:4
at async instantiateModule (file:///project/node_modules/vite/dist/node/chunks/dep-9A4-l-43.js:50861:9)
5 replies
DTDrizzle Team
•Created by CrisOG on 1/31/2024 in #help
Placeholder does not work properly with update
const update = db
.update(userTable)
.set({ name: sql.placeholder('name') })
.where(eq(userTable.id, sql.placeholder('id')))
.prepare('updateUser');
const update = db
.update(userTable)
.set({ name: sql.placeholder('name') })
.where(eq(userTable.id, sql.placeholder('id')))
.prepare('updateUser');
8 replies