Search code examples
pythonpostgresqlflaskdatabase-migrationheroku-postgres

Updating prod postgresql db with Flask Heroku


I have ran the following command in my dev db:

flask db migrate -m "updated the schema" 
flask db upgrade

Which successfully did the migration and updated the schema. However, when I pushed the commit to heroku the prod schema didn't change. How can I do the same update in heroku prod postgresql?

I tried switching my profile code from:

web: gunicorn run:app --log-file=- 

to:

web: flask db upgrade; gunicorn run:app --log-file=- 

& even adding:

heroku config:set FLASK_APP=run.py

for restarting. However, the prod db schema remains unchanged.


Solution

  • The following commands did the job:

    Heroku run bash
    flask db migrate
    flask db upgrade