Git-like CLI tool for database schema version control with multi-database support
Project description
dbit - Database Schema Version Control
A Git-like CLI tool for managing database schemas with version control capabilities.
Features
- Git-like interface for database schema management
- Support for PostgreSQL, MySQL, and SQLite
- Schema snapshots and version tracking
- Schema quality validation
- Change detection and comparison
Installation
Using PyPI (Recommended)
pip install dbit
Using GitHub (Latest)
pip install git+https://github.com/nrnavaneet/dbit.git
From Source (Development)
git clone https://github.com/nrnavaneet/dbit.git
cd dbit
python -m venv venv
source venv/bin/activate
pip install -e .
With Docker
docker pull ghcr.io/nrnavaneet/dbit:latest
# Or build locally for development:
docker build --target development -t dbit:dev .
Usage Example
For a full list of commands and options, run:
dbit help
# or
dbit --help
# or
dbit -h
Common usage:
# Initialize a dbit repository in your project
dbit init
# Connect to your database
dbit connect --db-url postgresql://user:password@localhost/dbname
# Take a schema snapshot
dbit snapshot
# See changes since last snapshot
dbit status
# View schema change history
dbit log
# Run schema quality checks
dbit verify
Commands
| Command | Description |
|---|---|
dbit --help |
For full list of commands |
dbit init |
Initialize a new dbit repository |
dbit connect --db-url <url> |
Connect to a database |
dbit disconnect |
Disconnect from current database |
dbit snapshot [--content N] |
Create schema snapshot |
dbit status [--content N]. |
Show changes since last snapshot |
dbit log |
Show change history |
dbit verify |
Verify schema quality |
Connection Strings
# PostgreSQL
postgresql://user:password@host:port/database
# MySQL
mysql://user:password@host:port/database
# SQLite
sqlite:///path/to/database.db
Configuration
dbit stores configuration in .dbit/schema.yaml:
db: postgresql://user:password@localhost/dbname
migrations: []
current_version: v1.json
Documentation
Contributing
If you want to contribute to dbit, follow these steps:
Quick Developer Setup
Use the provided script to set up your environment:
./scripts/setup-dev.sh
This will:
- Check your Python version (3.8+ required)
- Create and activate a virtual environment (
venv) - Upgrade pip
- Install all development dependencies
- Install pre-commit hooks
- Run pre-commit on all files
After setup, activate your environment with:
source venv/bin/activate
Run tests with:
pytest
Run all pre-commit checks manually with:
pre-commit run --all-files
Manual Setup (Alternative)
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/dbit.git - Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate
- Install development dependencies:
pip install -e ".[dev]"
- Install pre-commit hooks:
pre-commit install - Create a feature branch, make your changes, run tests (
pytest), and submit a pull request.
Development with Docker
# Build development image
docker build --target development -t dbit:dev .
# Run development container
# Mount your code for live editing
# (from project root)
docker run -it --rm -v $(pwd):/app dbit:dev
License
MIT License - see LICENSE file for details.
Author
N R Navaneet
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dbit-0.1.1.tar.gz.
File metadata
- Download URL: dbit-0.1.1.tar.gz
- Upload date:
- Size: 31.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68aae5436b32be732b4927d70adc3635ca41593e793156f88b149a264a186cec
|
|
| MD5 |
0a66d6deeadeb00b8cce09d3e08a5be5
|
|
| BLAKE2b-256 |
f3beffd49c4519ec8bcc4b0f7a1bba8c54f23f75490c0a9cb9583ff8fbd6a578
|
File details
Details for the file dbit-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dbit-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
addec6718130c5049030204b8b35df79a9de97ea3911b8aa1e66e1f81ae7a12a
|
|
| MD5 |
89c359b9bc799da3f1ed95f3b584e66e
|
|
| BLAKE2b-256 |
d62e7b5794ea8d7d3fcea307755955cc5e75ef22c1181131b9e15bd7044ef0cb
|