A professional database migration tool supporting multiple databases
Project description
evolvishub-db-migration
Evolvis AI Database Migration Tool
About Evolvis AI
Evolvis AI is your partner in making your company a pioneer and leader in your industry. We are co-creators who continuously collaborate with you in developing our solutions. Our mission is to empower you with the necessary tools to make informed and precise decisions by integrating artificial intelligence into your processes.
Our Approach
- Co-creation: We continuously collaborate with you in developing our solutions
- Open Source Priority: We reduce costs and develop robust tools using open-source technologies
- Transparency: We keep you informed about progress continuously
Overview
The Evolvis AI Database Migration Tool is a robust and flexible solution for managing database schema changes across multiple database systems. It provides a comprehensive set of features for database version control, migration management, and rollback capabilities.
Quick Start
Command-Line Usage
# List available migrations
db-migrate --list
# Show migration status
db-migrate --status
# Apply pending migrations
db-migrate --apply
# Apply migrations with verbose output
db-migrate --apply -v
Key Features
-
Multi-Database Support
- SQLite
- PostgreSQL
- MySQL
- Microsoft SQL Server
-
Advanced Migration Management
- Transaction-based migrations
- Rollback support
- Migration tracking
- Version control
-
Professional Features
- Configurable logging
- Transaction timeout control
- Retry mechanisms
- Schema management
- Character set support
-
Development Tools
- Command-line interface
- Python library API
- SQLAlchemy integration
- Testing utilities
- Documentation support
Features
- 🚀 Multiple Database Support:
- SQLite (default)
- PostgreSQL
- MySQL
- Microsoft SQL Server (MSSQL)
- 🔄 Version Control:
- Migration naming convention (vX_description.sql)
- Automatic tracking of applied migrations
- Rollback support
- 📝 Flexible Configuration:
- File-based SQL migrations
- Inline SQL migrations in config
- Custom migration directory support
- 🛠️ Advanced Features:
- Transaction support
- Error handling and rollback
- Migration status tracking
- 📱 Command-line Interface:
- List migrations
- Apply migrations
- Status checking
Installation
From PyPI
Install the latest release:
pip install evolvishub-db-migration
From Source
For development or specific versions:
# Clone the repository
git clone https://github.com/evolvisai/evolvishub-db-migration.git
cd evolvishub-db-migration
# Install in development mode
pip install -e .
# Or install specific version
pip install git+https://github.com/evolvisai/evolvishub-db-migration.git@v0.1.0
Development
Testing
The project includes comprehensive test coverage:
# Run all tests
pytest
# Run with coverage
pytest --cov=evolvishub_db_migration
# Run specific test file
pytest tests/unit/test_migration_manager.py
Code Style
The code follows the Black code style:
# Format code
black src/ tests/
# Check code style
black --check src/ tests/
Documentation
Generate documentation using Sphinx:
# Build documentation
sphinx-build -b html docs/ docs/_build/
# View documentation
open docs/_build/html/index.html
Contributing
Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
For support, please:
- Check the documentation
- Search existing issues
- Create a new issue if needed
Contact
- Email: info@evolvis.ai
- Phone:
- Spain: +34 666 826 619
- Mexico: +52 818 706 9624
- Locations:
- Barcelona, Spain
- Monterrey, Mexico
Acknowledgments
- SQLAlchemy for database abstraction
- Alembic for migration inspiration
- All contributors and users
Configuration
Configure the tool using a migration.ini file in your project root:
[DEFAULT]
# Database Configuration
database_type = sqlite # sqlite, postgresql, mysql, mssql
connection_string = sqlite:///./database.db
migration_directory = migrations
# Optional Settings
transaction_timeout = 30 # seconds
retry_attempts = 3
log_level = INFO # DEBUG, INFO, WARNING, ERROR
[MIGRATIONS]
# Inline SQL migrations
v1_create_users_table = CREATE TABLE users (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL);
# Rollback SQL (optional)
rollback_v1_create_users_table = DROP TABLE users;
Migration Files
Create SQL files in your migrations directory following the naming convention: vX_description.sql
-- migrations/v2_add_profiles_table.sql
-- Description: Add profiles table with user reference
CREATE TABLE profiles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
bio TEXT,
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- rollback.sql
DROP TABLE profiles;
Running Migrations
List available migrations:
db-migrate --list
Apply pending migrations:
db-migrate --apply
Check migration status:
db-migrate --status
Migration Best Practices
- Use descriptive version numbers (v1_, v2_, v3_, etc.)
- Keep migrations atomic and focused
- Include rollback SQL in comments
- Use proper SQL formatting
- Document complex migrations
Database Support
SQLite
[DEFAULT]
database_type = sqlite
connection_string = sqlite:///./database.db
PostgreSQL
[DEFAULT]
database_type = postgresql
connection_string = postgresql://user:password@localhost:5432/dbname
MySQL
[DEFAULT]
database_type = mysql
connection_string = mysql://user:password@localhost:3306/dbname
MSSQL
[DEFAULT]
database_type = mssql
connection_string = mssql://user:password@localhost:1433/dbname
Development
- Clone the repository
- Create a virtual environment
- Install dependencies
- Run tests
- Submit a PR
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Thanks to all contributors
- Inspired by database migration tools like Alembic and Flyway
- Special thanks to the SQLAlchemy team for their excellent database toolkit
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 evolvishub_db_migration-0.1.1.tar.gz.
File metadata
- Download URL: evolvishub_db_migration-0.1.1.tar.gz
- Upload date:
- Size: 273.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7649eaf3c8e8b223624d193d59c2db076342a52e8dbe08ae7849d80c5fe9984f
|
|
| MD5 |
e29cdf1f476fcc6eced1c6747d1bfd49
|
|
| BLAKE2b-256 |
ea7b233711bac2ccee89f14ffd598571b682bd8999bf9329df883d07760e03c9
|
File details
Details for the file evolvishub_db_migration-0.1.1-py3-none-any.whl.
File metadata
- Download URL: evolvishub_db_migration-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc327f8929b32668876fd9a41b8e3584c9241d26485211466b1ac67b8379670b
|
|
| MD5 |
b3bcfd817cc3db2aaf9847191175cbe0
|
|
| BLAKE2b-256 |
570326ad083781c10959ff1c91540ba51953da14006d6d23c5ad139513b78196
|