Lightweight and extensible Python library for managing database migrations
Project description
🛠️ Migropy
Migropy is a lightweight and extensible Python library for managing database migrations.
Designed for simplicity and flexibility, it helps teams apply, track, and version-control schema changes across multiple
environments.
🚀 Features
- ✅ Versioned migrations with up/down support
- ✅ Compatible with PostgreSQL
- ✅ CLI for common migration operations
- ✅ Safe and idempotent execution
- ✅ Customizable migration directory structure
📦 Installation
pip install migropy
📖 How to use
1. Initialize a new migration project
migropy init
2. Go to the migrations directory
cd migrations
3. Fill the config.ini file
[database]
host = localhost
port = 5432
user = postgres
password = postgres
dbname = my_database
type = postgres
[logger]
level = DEBUG
4. Create a new migration
migropy generate 'migration name'
5. Apply the migrations
migropy apply
📄 Migration example
-- Up migration
CREATE TABLE users
(
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(100) NOT NULL
);
-- Down migration
DROP TABLE users;
⚙️ Available commands
| Comando | Descrizione |
|---|---|
migropy init |
Init migratron environment |
migropy generate <name> |
Generate a new sql migration |
migropy upgrade |
Apply all the migration |
migropy downgrade |
Rollback all revisions |
migropy list |
Show current migration status |
📄 License
MIT License © 2025 — teoxy
Project details
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 migropy-0.1.1.tar.gz.
File metadata
- Download URL: migropy-0.1.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa590d98d64a7c18e0d0cd0fb0b3ca9a7e87ac0cbc61f31b20475431e2d252c2
|
|
| MD5 |
f08522d1d6b77e72c34dd73961d43131
|
|
| BLAKE2b-256 |
af3f4cbf0cb4e405f85ff25847934aab1374c3f2d468105aa44c4e1df7a34012
|
File details
Details for the file migropy-0.1.1-py3-none-any.whl.
File metadata
- Download URL: migropy-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.13.2 Darwin/24.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
401581592d93888fa263a30c533bb66d6101e369efc9207f715f4684fa6c2c10
|
|
| MD5 |
e60514eb51f8fac34878ee70852c85b4
|
|
| BLAKE2b-256 |
675e40c29d63201ee138cd36bd904463e8fef0c9b55a22ace555cdcab5cbfe7d
|