MyDB is a powerful database management tool that provides Git-like branching functionality for MySQL databases. It allows developers to create isolated database environments, manage migrations, and merge changes between branches.
π Related Documentation:
- π³ Git-like branching for databases
- π Table creation and management
- π Database migrations with up/down support
- π Branch merging capabilities
- π± GUI interface via MyDB Studio
- π Automated schema tracking
- π Detailed migration history
- Python 3.7+
- MySQL Server 5.7+ or 8.0+
- pip (Python package manager)
- Clone the repository:
git clone https://github.com/yourusername/mydb-cli.git
cd mydb-cli- Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install the package in development mode:
pip install -e .Note: requirements.txt is a frozen list of dependencies generated from setup.py and can be used for specific deployment scenarios if needed, but direct installation via setup.py (using pip install -e .) is the primary method for setting up the development environment.
- Initialize your database configuration:
mydb-cli status
This will create a default configuration file at .mydb/config.json.
- Update the configuration file with your MySQL credentials:
{
"connection": {
"user": "your_username",
"password": "your_password",
"host": "localhost",
"port": 3306,
"database": "your_database",
"auth_plugin": "mysql_native_password"
}
}Create a new branch:
mydb-cli create-branch --branch dev
List all branches:
mydb-cli list-branches
Switch to a different branch:
mydb-cli switch-branch --branch dev
Delete a branch:
mydb-cli delete-branch --branch old_feature
Merge branches:
mydb-cli merge-branch --source feature --target main
Create a new table:
mydb-cli create-table --name users
# Follow the interactive prompts to define columnsList all tables:
mydb-cli list-tables
Describe table structure:
mydb-cli describe-table --name users
Drop a table:
mydb-cli drop-table --name old_table
Create a new migration:
mydb-cli create-migration --name add_users_table --description "Create users table with basic fields"Apply migrations:
mydb-cli migrate-up # Apply next pending migration mydb-cli apply-migration --number 1 # Apply specific migration
Rollback migrations:
mydb-cli migrate-down # Rollback last applied migrationCheck migration status:
mydb-cli migration-status
Launch the MyDB Studio interface:
mydb-cli studio
.
βββ LICENSE
βββ README.md
βββ assets
β βββ index-BKO7flFT.css
β βββ index-D0-aluUL.js
βββ image-1.png
βββ image.png
βββ index.html
βββ main.py
βββ migrations/
βββ requirements.txt
βββ streamlit.png
βββ studio.py
βββ testsqlcode01.txt
βββ testsqlcode02.txt
βββ vite.svg
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the BSD 3-Clause License - see the LICENSE file for details. This would allow me to make some features of this tool to be served on a proprietory basis as well where i'll earn by providing subscriptions for my dev tool features.
If you encounter any issues or have questions, please open an issue on GitHub.