SQLite: timestamp
vs timestamp_ms
modes
#1007
-
What's the difference between The SQLite column types docs mention there's multiple modes for integers with the following example: import { integer, sqliteTable } from "drizzle-orm/sqlite-core";
// you can customize integer mode to be timestamp, timestamp_ms
integer('id', { mode: 'timestamp_ms' })
integer('id', { mode: 'timestamp' }) // Date My assumption is the following:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Since there is no built-in date format in SQLite, we need to choose the format in which the date is stored in the DB. |
Beta Was this translation helpful? Give feedback.
-
How would we modify our |
Beta Was this translation helpful? Give feedback.
Since there is no built-in date format in SQLite, we need to choose the format in which the date is stored in the DB.
timestamp_ms
stores and operates with the date as a number of milliseconds.timestamp
uses seconds instead. So if you want to have milliseconds precision, or if you already have the date stored as milliseconds in the DB, you should choosetimestamp_ms
.