QUESTPIE

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 push

This applies schema changes without creating migration files.

Production: Migrations

For production, use migration files for auditable schema changes:

Generate

bunx questpie migrate:generate

Creates a migration file in your configured directory.

Run migrations

bunx questpie migrate:up

Cloudflare 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:up

Do 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:down

Fresh (destructive)

Drop everything and re-run all migrations:

bunx questpie migrate:fresh
Destroys all data. Development only.

Reset

Reset migration tracking state:

bunx questpie migrate:reset

Configuration

questpie.config.ts
export default runtimeConfig({
	cli: {
		migrations: {
			directory: "./src/migrations",
		},
	},
});

Seeds

Populate the database with initial data:

bunx questpie seed

Seed files go in the configured seeds directory:

questpie.config.ts
cli: {
  seeds: {
    directory: "./src/seeds",
  },
}
  • Database — PostgreSQL setup
  • CLI — All CLI commands

On this page