First backup in 60 seconds
1. Create a database
Section titled “1. Create a database”CREATE DATABASE myapp;Nothing else. A new database gets its first backup immediately, then follows its schedule (default: daily at 02:00, keep 14 backups, max 90 days).
2. Watch it
Section titled “2. Watch it”\c myappSELECT state, last_backup_at, next_backup_at, location FROM pgbx.status();SELECT * FROM pgbx.backups; -- id, taken_at, age, trigger, size, bytes, s3_keyOr from the shell:
pgbx status --db myapppgbx list --db myapp --json3. Take one now
Section titled “3. Take one now”SELECT pgbx.backup_now(); -- returns a job idSELECT state, error FROM pgbx.history WHERE id = 42;pgbx now --db myapp --wait4. Restore it into a new name
Section titled “4. Restore it into a new name”SELECT pgbx.restore(into_db => 'myapp_restored');The live database is never touched. Check myapp_restored, then swap names yourself.
5. Set your own policy (in a migration)
Section titled “5. Set your own policy (in a migration)”SELECT pgbx.configure(schedule => 'every 6 hours', max_backups => 28, max_days => 30);Bad schedules and retention above pgbx.max_days_limit are rejected immediately.