https://github.com/eatfirst/flask-click-migrate
SQLAlchemy database migrations for Flask applications using Alembic with Click
https://github.com/eatfirst/flask-click-migrate
alembic click flask sqlalchemy
Last synced: about 1 month ago
JSON representation
SQLAlchemy database migrations for Flask applications using Alembic with Click
- Host: GitHub
- URL: https://github.com/eatfirst/flask-click-migrate
- Owner: eatfirst
- License: mit
- Created: 2016-08-19T13:06:47.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-01-16T09:08:01.000Z (over 9 years ago)
- Last Synced: 2024-04-14T06:47:43.422Z (about 2 years ago)
- Topics: alembic, click, flask, sqlalchemy
- Language: Python
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Flask Click Migrate
A simple click "addon" to add an alembic wrapper (basically a port from Flask-Migrate to click).
## Usage
```
Usage: manage.py db [OPTIONS] COMMAND [ARGS]...
Perform database migrations
Options:
--help Show this message and exit.
Commands:
branches Show current branch points.
current Display the current revision for each...
downgrade Revert to a previous version.
heads Show current available heads in the script...
history List changeset scripts in chronological...
init Generate a new migration.
merge Merge two revisions together.
migrate Create a new migration based on SQLAlchemy...
revision Create a new revision file.
show Show the revision denoted by the given...
stamp 'Stamp' the revision table with the given...
upgrade Upgrade to a later version.
```
## Configuring
```python
import click
from flask_click_migrate import Migrate, MigrateGroup
from my_app import app, db
migrate = Migrate(app, db)
migrate_command = MigrateGroup(migrate_instance=migrate)
@click.group()
def your_click_group():
"""Click group."""
pass
your_click_group.add_command(migrate_command)
if __name__ == '__main__':
your_click_group()
```