$defaultFn() for an ISO timestamp in a text() field set as NULL

Schema:
export const users = sqliteTable("user", {
  id: text("id")
    .primaryKey()
    .$defaultFn(() => crypto.randomUUID()),
  name: text("name"),
  email: text("email").unique(),
  createdAt: text('created_at').$defaultFn(() => new Date().toISOString()),
  updatedAt: text('updated_at').$defaultFn(() => new Date().toISOString())
})


Im not sure why but when a new user is created, Turso will leave the both createdAt and updatedAt columns as "NULL" although I've set my default function as above.
image.png
Was this page helpful?