Current settings in the api module are set to ignore tables that are not backed by a model. You have been warned. |
Alembic, via Flask-Migrate is used to manage our database. Changes to the models are put into a revision history.
To create a model update for the database do the following:
cd api
python manage.py db migrate
git add migrations
# git commit / push / pull to GitHub
python manage.py db upgrade
- cd to the root director of the component
- cd api
- python manage.py db migrate
- this will add a new revision into the migrations/versions directory
- Add the migrations to GitHub
- python manage.py db upgrade
- this will upgrade the database to support your new model
If you need to add fixture data (eg.a lookup table with default values) then you can add them to your revision of the model or make a new revsion and add your changes to that file.
To make a new revision file:
python manage.py db revision -m 'short_name_of_your_revision'
You can ask Alembic for the latest version:
python manage.py db revision