Open Pramuspl opened 2 months ago
This is happening to me as well. Doing e.g. createdAt: text("created_at").notNull().default(sql
(current_timestamp))
will simply write (current_timestamp)
to the database when editing in the studio. I presume this would also be the case when doing it programatically. What works, is using $default
/$defaultFn
instead like so: createdAt: text("created_at").notNull().$default(() => new Date().toISOString())
, although this would only work at runtime, and not at the database level.
What version of
drizzle-orm
are you using?0.30.9
What version of
drizzle-kit
are you using?0.20.17
Describe the Bug
For a following table:
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.
Expected behavior
Execute
uuid4()
andcurrent_timestamp
on row creation regardless of the methodEnvironment & setup
No response