/pg_branch

[WIP] Branch your development postgres database like you do in git

Primary LanguageRustApache License 2.0Apache-2.0

pg_branch

Tests Clippy Rustfmt

Branch your postgres database like you do in Git

  • 🐘 Branch your development Postgres DB like you do in Git!
  • 🚀 Fast DB copying, no pg_dump / pg_restore (by default)!
  • 💻 Rust-based single binary, supports Windows, Linux & Mac.
  • 📂 Auto-discovers your Git setup & branches.

Warning: This is a work in progress.

Why?

Ever wanted to test a migration in isolation? then revert back to your main development database quickly? Or test a pull request or a feature-branch without the need to give up your development database's data or schema.

pg_branch goal is to help provide quick copies of your current development database, then help you manage those copies (drop, rename, cleanup, ..etc). This is especially usefull when provisioning "preview environments" that are a copy of staging/prod, e.g. a database per Vercel PR preview.

Demo

pg_branch

TODO:

  • More tests
  • Git hooks / Husky support
  • Pre-built binaries for Mac/M1, Linux & Windows.
  • npm package
  • switch --no-rename mode
  • pg_branch run <shell|os> command> for the no-rename mode.
  • VCS agnostic?