3

I'm running a simple Flask app with Heroku, and I can run the following command to create all the tables:

db.create_all()

However, I ship new stuff frequently and I often need to add new columns to existing tables. Is there an easy way to do this?

If I need to manually create a new column with Postgres, how would I access the repl for Heroku's Postgres database?

1 Answer 1

7

You should be using migrations.

This is a great plugin for that: https://flask-migrate.readthedocs.io/en/latest/

and this is a good explanation about how to get going with that: https://realpython.com/flask-by-example-part-2-postgres-sqlalchemy-and-alembic/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.