createdAt and expiresAt defaults

Is this the best way?
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
expiresAt: timestamp('expires_at', { withTimezone: true }).default(sql`(now() + interval '7 days')`),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
expiresAt: timestamp('expires_at', { withTimezone: true }).default(sql`(now() + interval '7 days')`),
1 Reply
Andrii Sherman
the only way for now if you wan to have those defaults on database level
Want results from more Discord servers?
Add your server