Open JDGuillaume opened 2 days ago
$defaultFn
only works at runtime when queries are run with the drizzle client. Not sure if drizzle studio runs these 🤔
For a "true" default value, you should use default
with a tagged sql
expression: https://orm.drizzle.team/docs/column-types/sqlite#default-value
This section has some examples as well: https://orm.drizzle.team/docs/guides/timestamp-default-value#sqlite
I would prefer this example since it stores the value as seconds in the DB but can be used as a Date object in JS:
timestamp1: integer('timestamp1', { mode: 'timestamp' })
.notNull()
.default(sql`(unixepoch())`),
Hey CJ! First off - Thank you for the video and thoroughly enjoyed seeing what Hono can do!
Running into an issue with Drizzle where the database schema is resulting in
NULL
values for the timestamp fields (e.g.,createdAt
,updatedAt
).The resulting value in the database is:
Edit #1 Relevant
package.json