Running migrate() in Sveltekit project
I have a migrate.ts file with the script for running migrate(), how would you typically execute this in a sveltekit project? I tried adding it to a npm script:
"migrate": "ts-node src/lib/server/database/migrate.ts"
but I get errors here (ERR_UNKNOWN_FILE_EXTENSION
). Any ideas?3 Replies
i use
tsx
dont know if this is a ts-node
issue
i have a script something like this tsx ./src/lib/server/db/migrate.ts
if you are using sveltekit $env
variables in migrate.ts
mind you that will not work
ah okay thanks! will try this
Here is my Migrate script from my sveltekit project
And I invoke it with:
From memory, the --loader ts-node/esm is why you're getting 'file extension not found'