V0.2.0
All checks were successful
Build Docker Image / build (push) Successful in 12m39s

This commit is contained in:
2025-02-13 17:46:15 -08:00
parent 9544b0415c
commit b7e89d9c22
17 changed files with 455 additions and 24 deletions

32
app/migrations.py Normal file
View File

@@ -0,0 +1,32 @@
import logging
import os
from alembic.config import Config
from alembic import command
from flask import Blueprint
from app.config import Config as AppConfig
migrations_bp = Blueprint("migrations", __name__)
def run_migrations(app):
"""Run database migrations"""
try:
# Create Alembic configuration object
alembic_cfg = Config("alembic.ini")
# Get the database URL from your app's config
database_url = AppConfig.SQLALCHEMY_DATABASE_URI
print(database_url)
# Set the SQLAlchemy URL
alembic_cfg.set_main_option("sqlalchemy.url", database_url)
logging.debug(f"Database URL set to: {database_url}")
# Run the migration
command.upgrade(alembic_cfg, "head")
logging.info("Database migration completed successfully")
return True
except Exception as e:
logging.error(f"Migration failed: {str(e)}")
return False