Need help with 'onConflictDoUpdate' method

Hello, I'm using 'drizzle-orm/neon-serverless' package with Postgres database
When using onConflicDoUpdate method, I got this error "column reference "column_name" is ambiguous"
Here is my code :
const upsertLead = await db
    .insert(lead)
    .values(leadsInfo)
    .onConflictDoUpdate({
      target: lead.phone,
      set: {
        email: leadsInfo.email,
        firstName: leadsInfo.firstName,
      },
    })
    .returning()
    .execute();


Here is my "lead" table definiton :

export const lead = createTable(
  "lead",
  {
    id: serial("id").primaryKey(),
    type: varchar("type", { length: 255 }).notNull(),
    firstName: varchar("first_name", { length: 255 }).notNull(),
    lastName: varchar("last_name", { length: 255 }).notNull(),
    phone: varchar("phone", { length: 255 })
      .notNull()
      .unique("uniqueLeadPhone"),
    email: varchar("email", { length: 255 }).notNull(),
    createdById: integer("created_by_id")
      .notNull()
      .references(() => users.id),
    lastModifiedById: integer("last_modified_by_id")
      .notNull()
      .references(() => users.id),
    createdAt: timestamp("created_at", {
      precision: 3,
      withTimezone: true,
    }).default(sql`CURRENT_TIMESTAMP`),
    updatedAt: timestamp("updated_at", {
      precision: 3,
      withTimezone: true,
    }).default(sql`CURRENT_TIMESTAMP`),
  },
);


Maybe someone already get this error ?
Was this page helpful?