My deployment strategy looks like this (using Fabric):
- create a new virtualenv
- deploy new code in new virtualenv
- show a maintenance page
- copy the current db to new db
- migrate new db
- point new code to new db
- symlink current virtualenv to new venv
- restart services
- remove maintenance page
I want to iterate fast. Now, most of the code changes do not contain migrations. Also, the db is growing, so there is much overhead created by copying the database everytime I deploy a (mostly small) change. To avoid copying the database I want to check whether there are migrations that need to be deployed (prior to step 4). If there are no migrations, I can go straight from step 2 to step 7. If there are, I will follow all the steps. For this, I need to check programmatically whether there are migrations that need to be deployed. How can I do this?