Issue with CURRENT_TIMESTAMP bun:sqlite
I have the following table:
export const token = sqliteTable("token", {
token: text("token").notNull().primaryKey(),
usage_started: integer("usage_started", { mode: "boolean" })
.notNull()
.default(false),
usage_started_timestamp: integer("usage_started_timestamp", {
mode: "timestamp_ms",
}),
used: integer("used", { mode: "boolean" }).notNull().default(false),
used_timestamp: integer("used_timestamp", { mode: "timestamp_ms" }),
expiration_timestamp: integer("expiration_timestamp", {
mode: "timestamp_ms",
})
.notNull()
.default(-1),
instance_id: integer("instance_id")
.notNull()
.references(() => instance.id),
});
When running
await db.insert(token).values({
token: tokenId,
instance_id: instanceId,
expiration_timestamp: currentTimestamp + 86400000,
});
1 Reply
It launches an error:
66 | return new Date(value * 1e3);
67 | }
68 | return new Date(value);
69 | }
70 | mapToDriverValue(value) {
71 | const unix = value.getTime();
^
TypeError: value.getTime is not a function. (In 'value.getTime()', 'value.getTime' is undefined)
at mapToDriverValue (node_modules\drizzle-orm\sqlite-core\columns\integer.js:71:18)
atnode_modules\drizzle-orm\sql\sql.js:118:59
at map (:1:21)
at buildQueryFromSourceParams (node_modules\drizzle-orm\sql\sql.js:71:25)
at map (:1:21)
at buildQueryFromSourceParams (node_modules\drizzle-orm\sql\sql.js:71:25)
at map (:1:21)
at buildQueryFromSourceParams (node_modules\drizzle-orm\sql\sql.js:71:25)
at node_modules\drizzle-orm\sql\sql.js:51:21
at _prepare (node_modules\drizzle-orm\sqlite-core\query-builders\insert.js:125:7)
at node_modules\drizzle-orm\sqlite-core\query-builders\insert.js:135:12
at execute (node_modules\drizzle-orm\sqlite-core\query-builders\insert.js:146:19)
at then (node_modules\drizzle-orm\query-promise.js:21:12)
my drizzle config:
/** @type { import("drizzle-kit").Config } */
export default {
schema: "./schema.js",
out: "./migrations",
driver: "libsql",
verbose: true,
dbCredentials: {
url: "file:./db.sqlite",
},
};