SQLite functions not being called

I think I might've found a bug. At least in Studio, maybe in orm as well. Could someone please verify?

For a following table:

export const organizations = sqliteTable(
  "users",
  {
    id: text("id")
      .primaryKey()
      .default(sql`(uuid4())`),
    email: text("email").notNull(),
    updatedAt: text("updated_at")
      .notNull()
      .default(sql`current_timestamp`),
);



the following SQL query is generated:

CREATE TABLE `users` (
    `id` text PRIMARY KEY DEFAULT (uuid4()) NOT NULL,
    `email` text NOT NULL,
    `updated_at` text DEFAULT current_timestamp NOT NULL
);




When I add a new record via Drizzle Studio, I noticed that the SQLite functions are not being fired. They work fine when adding records manually using SQL queries but not when I use Drizzle Runner or via "Add record" button. Interestingly, the behaviour is slightly different in both cases. I presume the same error will occur when executing the queries from code.
324948135-b32e5506-5ff3-4a53-a198-656e20b16996.png
Was this page helpful?