oh-my-zsh-alembic
June 5, 2025 ยท View on GitHub
A comprehensive oh-my-zsh plugin for Alembic, the database migration tool for SQLAlchemy.
Features
- Command aliases for faster workflow
- Tab completion for all Alembic commands and options
- Helper functions for common operations
- Status overview functions
- Support for Alembic 1.16.1+
Installation
Using oh-my-zsh custom plugins
-
Clone this repository into your oh-my-zsh custom plugins directory:
git clone https://github.com/datumbrain/oh-my-zsh-alembic.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/alembic -
Add
alembicto your plugins list in~/.zshrc:plugins=(... alembic) -
Reload your shell:
source ~/.zshrc
Manual Installation
- Download
alembic.plugin.zsh - Place it in
~/.oh-my-zsh/custom/plugins/alembic/ - Follow steps 2-3 above
Usage
Aliases
| Alias | Command | Description |
|---|---|---|
alc | alembic current | Show current revision |
alh | alembic heads | Show available heads |
alhist | alembic history | Show revision history |
alshow | alembic show | Show specific revision |
alup | alembic upgrade | Upgrade to revision |
aldown | alembic downgrade | Downgrade to revision |
alrev | alembic revision | Create new revision |
albr | alembic branches | Show branch points |
alcheck | alembic check | Check for pending upgrades |
alstamp | alembic stamp | Stamp revision table |
almerge | alembic merge | Merge revisions |
aledit | alembic edit | Edit revision file |
Helper Functions
alup-head- Upgrade to head revisionalrev-m "message"- Create revision with messagealrev-auto "message"- Create auto-generated revision with messagealdown-1- Downgrade by one revisionalhist-v- Show verbose historyalembic-status- Show comprehensive status overviewalembic-init [directory]- Initialize Alembic with helpful reminders
Tab Completion
The plugin provides intelligent tab completion for:
- All Alembic commands
- Command-specific options and flags
- File paths for configuration files
- Revision identifiers where applicable
Examples
# Quick status check
alembic-status
# Create a new migration
alrev-auto "add user table"
# Upgrade to latest
alup-head
# Check what's pending
alcheck
# View recent history
alhist-v
# Downgrade one step
aldown-1
Requirements
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development
- 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
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Alembic - The database migration tool
- oh-my-zsh - Framework for managing Zsh configuration
- The Zsh completion system documentation
Note: This plugin is not officially affiliated with Alembic or SQLAlchemy.
Authors
- Fahad Siddiqui - Initial plugin development