~/docs/databases/migrations

Dashboard

Databases

Migrations

Migrations are plain SQL files in your repository. phz db push applies the ones a Postgres database hasn't seen, oldest first, and records them so each runs once.

Updated

2026-12-02

Source

apps/web/docs/databases/migrations.mdx

Write one

terminal

npx @pherwerz/cloud db migration new add_orders

This creates phz/migrations/<timestamp>_add_orders.sql. Write your SQL in it.

Apply them

terminal

npx @pherwerz/cloud db push orders-db --dry-run   # list what would run
npx @pherwerz/cloud db push orders-db

Each file runs in its own transaction. If one fails it is rolled back, the push stops there and exits 1; the files before it stay applied.