Skip to content

Migrations

Terminal window
curl -X POST https://postdb.dev/api/migrations \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "add_users_table",
"sql": "CREATE TABLE users (id UUID PRIMARY KEY DEFAULT gen_random_uuid(), email TEXT UNIQUE NOT NULL, created_at TIMESTAMPTZ DEFAULT NOW())"
}'
Terminal window
curl https://postdb.dev/api/migrations \
-H "Authorization: Bearer YOUR_API_KEY"

Returns all migrations with name, applied timestamp, and status.

  • Name migrations with a timestamp prefix: 20240115_add_users_table
  • Keep migrations additive where possible — avoid destructive DROP statements
  • Test rollback SQL before applying in production