String default for integer timestamps?
Hey folks, I'm using Drizzle with SQLite on CloudFlare D1. Using the following column schema:
From the D1 database viewer I am seeing that Drizzle creates values that look like this
2024-01-03 03:55:45
, whereas values inserted via direct SQL are integers properly e.g. 1703894400
. In addition, the string values show up as NULL
in Drizzle Studio. Could I be doing something wrong or have I encountered a bug?7 Replies
I think you should use like this
createdAt :timestamp('columnname').defaultNow()
SQLite doesn't have a timestamp type
I'm starting to think this is a bug
SQLite? Isn't D1 Postgres?
No sir
Drizzle ORM - next gen TypeScript ORM
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
GitHub
[BUG]: Incorrect default value of integer timestamp fields with D1 ...
What version of drizzle-orm are you using? 0.29.2 What version of drizzle-kit are you using? 0.20.8 Describe the Bug Using CloudFlare D1, when inserting rows, columns with this type: createdAt: int...
My bad, I'll shut up 😂