explaingit

xb1jaa/dbsnapshot

18ShellAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A command-line tool that saves timestamped snapshots of your database schema and shows you exactly what tables or columns changed between any two snapshots.

Mindmap

mindmap
  root((dbsnapshot))
    What it does
      Capture schema snapshots
      Compare two snapshots
      Export migration SQL
    Databases
      PostgreSQL
      MySQL
      SQLite
    Diff output
      Added columns
      Modified columns
      Removed columns
    Watch mode
      Interval checks
      Change alerts
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Track database schema changes during a sprint where multiple people are modifying table structures.

USE CASE 2

Generate a SQL migration script from the diff between two saved schema snapshots.

USE CASE 3

Set up watch mode during active development to get alerted the moment someone alters a table.

Tech stack

ShellPostgreSQLMySQLSQLiteJSON

Getting it running

Difficulty · easy Time to first run · 30min
Use freely for any purpose including commercial use, as long as you keep the copyright notice.

In plain English

dbsnapshot is a command-line tool that takes point-in-time snapshots of a database's structure and lets you compare any two snapshots to see what changed. The idea is similar to how version control tracks changes in code files, but applied to the shape of a database rather than its contents. The tool supports three database systems: PostgreSQL, MySQL, and SQLite. Running the capture command saves the current schema as a JSON file with a timestamp and a name you choose. You can then list saved snapshots, compare any two of them to get a diff showing added, modified, and removed columns or tables, or export the differences as SQL statements that could be applied as a migration script. A watch mode is also included, which checks the schema at a regular interval and alerts when something changes. This could be useful during active development when multiple people are touching the database structure. The diff output is formatted to show additions with a plus sign, modifications with a tilde, and removals with a minus sign, along with a summary count at the bottom. The README shows an example where one column was added, one was changed from a shorter to a longer text type, and one legacy column was removed. The repository is a shell script project licensed under MIT. The README is brief and does not include installation instructions or detail how the tool connects to databases. It is marked as ready for GitHub Codespaces, which suggests the intent is for it to work in a browser-based development environment without requiring local setup.

Copy-paste prompts

Prompt 1
I am using dbsnapshot to track my PostgreSQL schema. Walk me through capturing a baseline snapshot, making a schema change, capturing a second snapshot, and running the diff command to see what changed.
Prompt 2
I want to use dbsnapshot to automatically generate a migration script between two SQLite snapshots named before and after. Show me the exact commands to capture, diff, and export SQL.
Prompt 3
Set up a dbsnapshot watch command for a MySQL database that checks every 60 seconds and logs any schema changes to a file.
Open on GitHub → Explain another repo

← xb1jaa on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.