Have my app running in production with sqlalchemy but in my new update I had to update the database schema to add a new row in a table. If I restart my web server I get an error message saying that there is not such a column. How do I update the database schema without losing any data in production?
My run.py:
from myApp import create_app
from myApp.db_init import init_db
app = create_app()
init_db(app)
if __name__ == '__main__':
app.run(debug=True)
In init_db.py I have this:
def init_db(app):
with app.app_context():
db.create_all()