csv-library-website/library/deploydb.py

23 lines
449 B
Python
Raw Normal View History

2023-12-03 13:30:45 +01:00
from app import create_app, db
2023-12-03 14:19:53 +01:00
from flask_migrate import init, migrate, stamp, upgrade
2023-12-03 13:30:45 +01:00
def deploy():
"""Run deployment of database."""
# This model is required for flask_migrate to make the table
from application.models.usermodel import User # noqa: F401
2023-12-03 13:30:45 +01:00
app = create_app()
app.app_context().push()
db.create_all()
# migrate database to latest revision
init()
stamp()
migrate()
upgrade()
deploy()