Database migrations
Database migrations CI on GitHub Actions
Every test run replays the full migration history from an empty database.
3m → 4s
Migrations
Every test run replays the full migration history from an empty database.
Why it happens
The test database is created from scratch instead of from a cached schema snapshot.
What to change
- Dump the migrated schema once and load it directly in test jobs
- Use --keepdb or the equivalent so the database survives between runs
- Run migrations against a tmpfs-backed database for speed
- Test the migration path itself in a separate, less frequent job
Database migrations on runnerhut
yaml
jobs: test: runs-on: runnerhut-4vcpu-ubuntu-2404 services: postgres: { image: postgres:17, env: { POSTGRES_PASSWORD: postgres } } steps: - uses: actions/checkout@v4 - run: psql -f schema.sql - run: npm testThe only runnerhut-specific line is `runs-on: runnerhut-4vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.
Your next build could be twice as fast, at half the price
Start free. Migrating away is the same one line, and we publish that diff too.