SQLite Query

export function updateTodo(
  userID: string,
  todoToUpdate: TodoUpdate,
): Affected {
  const { listID } = mustGetTodo(todoToUpdate.id)
  requireAccessToList(listID, userID)
  const {
    text, complete, sort, id,
  } = todoToUpdate
  const updateItemStatementQuery = db
    .update(item)
    .set({
      title: sql<string>`'coalesce(${text}, title)'`,
      complete: sql<boolean>`'coalesce(${complete}, complete)'`,
      ord: sql<number>`'coalesce(${sort}, ord)'`,
      rowVersion: sql<number>`'row_version + 1)'`,
      lastModified: new Date(),
    })
    .where(eq(item.id, id))
    .prepare()

  updateItemStatementQuery.run()

  return {
    listIDs: [listID],
    userIDs: [],
  }
}


My Drizzle + TypeScript + SQLite (better-sqlite-3) fails on updateItemStatementQuery.run(). Why is that? I have updated my fields to contain double quotes with '' as suggested before from a previous help thread.
Was this page helpful?