Migrations
Database migrations — generate, up, down, push, fresh, reset.
QUESTPIE provides CLI commands for database schema management.
Development: Push
During development, use push to sync schema directly:
bunx questpie pushThis applies schema changes without creating migration files.
Production: Migrations
For production, use migration files for auditable schema changes:
Generate
bunx questpie migrate:generateCreates a migration file in your configured directory.
Run migrations
bunx questpie migrate:upCloudflare Workers
Run migrations outside Cloudflare Workers against the origin PostgreSQL database. Hyperdrive is a Worker binding, not a CLI database endpoint.
If your Worker config lazily uses Hyperdrive at runtime, provide a direct connection string for CLI commands:
QUESTPIE_CLI_DATABASE_URL="postgres://user:pass@host:5432/db" bunx questpie migrate:upDo not point pgNotifyAdapter or pgBossAdapter at a PgBouncer transaction pool in production. On Cloudflare, use cloudflareRealtimeAdapter and cloudflareQueuesAdapter; migrations only need the direct PostgreSQL connection for schema changes.
Rollback
bunx questpie migrate:downFresh (destructive)
Drop everything and re-run all migrations:
bunx questpie migrate:freshReset
Reset migration tracking state:
bunx questpie migrate:resetConfiguration
export default runtimeConfig({
cli: {
migrations: {
directory: "./src/migrations",
},
},
});Seeds
Populate the database with initial data:
bunx questpie seedSeed files go in the configured seeds directory:
cli: {
seeds: {
directory: "./src/seeds",
},
}