D1 should consider `undefined` as `null` I think, otherwise we have to use `value || null` for each

D1 should consider
undefined
as
null
I think, otherwise we have to use
value || null
for each field. For example, the description throw an error when
undefined


 await env.DB.prepare(
    `UPDATE Campaigns SET name = ?, description = ? WHERE campaign_id = ?`
  )
    .bind(
      campaign.name,
      campaign.description || null,
      campaign.campaign_id
    )
    .run();
Was this page helpful?