{"repo":"le-vlad/pgbranch","free":true,"listed":false,"github":"https://github.com/le-vlad/pgbranch","clone":"git clone https://github.com/le-vlad/pgbranch.git","description":"Git style branching for local PostgreSQL","language":"Go","stars":163,"topics":["git","postgresql","postgresql-database","branching","postgres","version-control"],"license":"MIT","category":"databases-storage","readme_excerpt":"pgbranch Git branching for your PostgreSQL database. Table of Contents - The Problem - The Solution - How It Works - Installation - Quick Start - Commands - Schema Diff - Schema Merge (Beta) - Continuous Migration - Automatic Branch Switching - Remotes - Using pgbranch as a Library - Caveats The Problem You're working on a feature branch. You run migrations. Life is good. Then you switch back to main . Your database is now in a broken state. The migrations from your feature branch are still applied. Your schema doesn't match your code. Nothing works. Your options: 1. Drop the database and re-seed (slow, painful) 2. Manually roll back migrations (error-prone, annoying) 3. Maintain multiple databases and remember to switch connection strings (who has time for that) None of these are good. The Solution That's it. Your database now has branches. Just like git. How It Works PostgreSQL has a feature called template databases. When you create a database from a template, it does a file-level copy. It's fast. pgbranch uses this to create instant snapshots of your database. When you \"checkout\" a branch, it drops your working database and recreates it from the snapshot. No pg dump. No restore. No waiting. Installation Quick Start Commands Init Options Schema Diff Compare the schema between two database branches to see what changed. What It Detects - Tables : Created, dropped - Columns : Added, removed, type changes, nullability, defaults - Indexes : Created, dropped, modified - Constrai","default_branch":null,"files":null,"tree":[],"storefront":"/r/le-vlad","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/le-vlad/pgbranch/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}