Hey guys, I’m hoping this is the last RDS migratio...
# help
b
Hey guys, I’m hoping this is the last RDS migration I’m ever going to post here 🤞 Need to create a table where a field needs to default to the
CURRENT_TIMESTAMP()
function. In TypeScript I would have done this:
Copy code
import { sql } from "kysely";

.addColumn("valid_since", "datetime", col => col.notNull().defaultTo(sql`CURRENT_TIMESTAMP()`))
The migration handler obviously doesn’t like the kysely import (using
require
since it’s in JavaScript) giving me the error
MODULE_NOT_FOUND
. Read around the docs and can’t see anything specific about migration dependencies or packaging options. Any thoughts?
f
@thdxr is there a way to write this migration without importing
kysely
in this case?
t
I think you can use db.raw("CURRENT_TIMESTAMP")
b
I’ll give it a shake.
Nailed it. Thanks for all the help with this guys, it’s been a great learning experience!