Database migration using sqlite

What is the best way to run a database migration using a sqlite database on fly.io?

Should I place my migration script in my Dockerfile or my fly.toml

For reference, this is my migration script in my package.json

"db:up": "vite-node ./src/lib/server/migrate.ts"

Is there anyway to do a sort of dry run, before fly deploy?

You could use docker entrypoint with a script.

Dockerfile:

COPY ./entrypoint.sh .

...

ENTRYPOINT ["sh", "entrypoint.sh"]

entrypoint.sh:

#!/bin/env sh

set -e

npm run db:up

exec npm start
1 Like

I just run it in the code. Doing it in Dockerfile is also a good idea.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.