Skip to content

Instantly share code, notes, and snippets.

View bobfang1992's full-sized avatar
🏠
Working from home

Bob Fang bobfang1992

🏠
Working from home
View GitHub Profile
@bobfang1992
bobfang1992 / Alembic for different envs
Last active July 4, 2020 08:35 — forked from twolfson/README.md
Toggling between `alembic` databases
`alembic` is great but lacks an out of the box way to set up running migrations against a specific database (e.g. `development`, `test`, `production`). The following adjustments to its `env.py` and `alembic.ini` allow us to target a specific database:
**Example:**
```bash
alembic -x db=development upgrade head
```
**env.py:**