2022-01-05 13:42:24 +01:00
|
|
|
def deploy():
|
2024-05-28 23:02:17 +02:00
|
|
|
"""Run deployment of database."""
|
|
|
|
from flask_migrate import init, migrate, stamp, upgrade
|
2024-04-28 13:04:07 +02:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
from app import create_app, db
|
|
|
|
from models.distribusi_model import Distribusis # noqa: F401
|
|
|
|
from models.distribusi_file_model import DistribusiFiles # noqa: F401
|
2024-04-28 13:15:23 +02:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
# This model is required for flask_migrate to make the table
|
|
|
|
from models.user_model import User # noqa: F401
|
2022-02-13 23:06:16 +01:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
app = create_app()
|
|
|
|
app.app_context().push()
|
|
|
|
db.create_all()
|
2022-01-05 13:42:24 +01:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
# migrate database to latest revision
|
|
|
|
init()
|
|
|
|
stamp()
|
|
|
|
migrate()
|
|
|
|
upgrade()
|
2022-01-05 13:42:24 +01:00
|
|
|
|
|
|
|
|
|
|
|
deploy()
|