Database schema migration runner with drift detection, version tracking, and rollback support.
Project description
🗄️ db-migrate-cli
Database Schema Migration Runner with Drift Detection
A Python CLI tool that manages database migrations, detects schema drift between expected and actual states, and audits migration quality with 10 rules.
Features
| Command | What It Does |
|---|---|
db-migrate-cli status |
Show migration file status and history |
db-migrate-cli drift |
Detect schema drift between expected and actual |
db-migrate-cli audit |
Audit migration files for quality (10 rules) |
db-migrate-cli demo |
Run full demo with sample data |
db-migrate-cli rules |
List all migration quality rules |
Installation
git clone https://github.com/sanjaysundarmurthy/db-migrate-cli.git
cd db-migrate-cli
pip install -e .
Quick Start
db-migrate-cli demo -v
db-migrate-cli drift expected-schema.yaml actual-schema.yaml -v
db-migrate-cli audit ./migrations -v
db-migrate-cli status ./migrations
Drift Detection
Compares expected schema (from YAML/migrations) against actual database state:
- Missing/extra tables, columns, indexes
- Type mismatches, nullable differences, default value changes
- Severity scoring: CRITICAL → LOW with grade A+ to F
Migration Quality Rules (10)
| Rule | Severity | Description |
|---|---|---|
| MIG-001 | CRITICAL | Migration missing DOWN section |
| MIG-002 | HIGH | DROP TABLE without IF EXISTS |
| MIG-003 | HIGH | Destructive column drop |
| MIG-004 | MEDIUM | No transaction wrapping |
| MIG-005 | MEDIUM | Data manipulation in schema migration |
| MIG-006 | LOW | Migration file exceeds 100 lines |
| MIG-007 | HIGH | CREATE TABLE without primary key |
| MIG-008 | MEDIUM | Non-sequential migration version |
| MIG-009 | LOW | Name contains special characters |
| MIG-010 | INFO | CREATE INDEX without CONCURRENTLY |
Export Formats
Terminal (Rich), JSON, HTML
License
MIT
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 db_migrate_cli-1.0.0.tar.gz.
File metadata
- Download URL: db_migrate_cli-1.0.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
75091e7cc8a2a3bd34327927b1ba6e8d5be60ccf315d8a72e99dc43ff4817150
|
|
| MD5 |
e16dbb9e312ac1300a2f29dd0721e572
|
|
| BLAKE2b-256 |
3013ab8ec5aa4235cc079b4eaa9e3ea3a2a26f048e5d943adfaaee4440a2f552
|
File details
Details for the file db_migrate_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: db_migrate_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ccb21b1f3e3be587be879e0f4e3201443d9bf52ae40b885ec44ab1da5c37b1e
|
|
| MD5 |
46632c557637ea070131b336662cea03
|
|
| BLAKE2b-256 |
ff19fd3ace9906e3ca1ac163c5888fa097b93c79a49e0570b324bfac487face5
|