db.update fails with undefined 'relation.referencedTable'

Running into a strange
undefined
error when running db.update on the lone table in my SQLite database.

app.put("/todos/:id", async (c) => {
  const { id } = c.req.param();
  const existing = await db.query.todos.findFirst({ with: { id } });
  if (existing) {
    await db
      .update(todos)
      .set({ complete: !existing.complete })
      .where(eq(todos.id, id));
  }
  const result = await db.query.todos.findMany();
  return c.html(<Todos todos={result} />);
});


The offending lines are db.update(todos).set... where db is the connection to the database through Drizzle, and todos is a table defined by:
export const todos = sqliteTable("todos", {
  id: text("id").primaryKey(),
  name: text("name").notNull(),
  complete: integer("complete", { mode: "boolean" }).notNull().default(false),
});


I can't find anyone who's run into this same issue, hoping someone has some insight on whether I've screwed up the syntax here.
CleanShot_2023-11-14_at_11.12.402x.png
Was this page helpful?