© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•7mo ago•
1 reply
jsingleton37

Question about default values for timestamp

Currently in my db I am doing (setup a year or so ago)
createdAt: timestamp('created_at')
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),
createdAt: timestamp('created_at')
    .default(sql`CURRENT_TIMESTAMP`)
    .notNull(),


for creating a default. However, I was looking at the docs and I see
timestamp1: timestamp('timestamp1').notNull().defaultNow(),
timestamp2: timestamp('timestamp2', { mode: 'string' })
  .notNull()
  .default(sql`now()`),
timestamp1: timestamp('timestamp1').notNull().defaultNow(),
timestamp2: timestamp('timestamp2', { mode: 'string' })
  .notNull()
  .default(sql`now()`),


What are the differences and which one should I be using nowadays?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Invalid default value for timestamp
Drizzle TeamDTDrizzle Team / help
3y ago
Default values to integer timestamps in sqlite
Drizzle TeamDTDrizzle Team / help
3y ago
Default values not working for insert
Drizzle TeamDTDrizzle Team / help
3y ago
String default for integer timestamps?
Drizzle TeamDTDrizzle Team / help
3y ago