My queries insert/delete are coming back with in error ...

Error inserting user: [Error: This function can now be called only as a tagged-template function: sqlSELECT ${value}, not sql("SELECT $1", [value], options). For a conventional function call with value placeholders ($1, $2, etc.), use sql.query("SELECT $1", [value], options).] 0.30.6
const u :typeof users.$inferInsert = {
clerkId,
name,
imageUrl,
}
await db.insert(users).values(u)

const u :typeof users.$inferInsert = {
clerkId,
name,
imageUrl,
}
await db.insert(users).values(u)

schema:
export const users = pgTable("users",{
id: uuid("id").primaryKey().defaultRandom(),
clerkId: text("clerk_id").notNull().unique(),
name:text("name").notNull(),

imageUrl:text("image_url").notNull(),
createdAt:timestamp("created_at").notNull().defaultNow(),
updatedAt:timestamp("updated_at").notNull().defaultNow(),
},(t)=>[uniqueIndex("clerk_id_idx").on(t.clerkId)])
export const users = pgTable("users",{
id: uuid("id").primaryKey().defaultRandom(),
clerkId: text("clerk_id").notNull().unique(),
name:text("name").notNull(),

imageUrl:text("image_url").notNull(),
createdAt:timestamp("created_at").notNull().defaultNow(),
updatedAt:timestamp("updated_at").notNull().defaultNow(),
},(t)=>[uniqueIndex("clerk_id_idx").on(t.clerkId)])
1 Reply
otostub
otostubOP3w ago
solved : needed to update drizzle orm

Did you find this page helpful?