- New run_migrations.py script - Runs all SQL files in migrations/ on startup - Tracks executed migrations in schema_migrations table - Retries database connection (30 attempts) - Separate Shinkan DB (shinkan_dev / shinkan) This ensures a clean separation from Mitai database.
This commit is contained in:
1 parent
91e665c960
commit
fd5efa8662
2 files changed
+158
-3
No files matched your search
+10
-3
@@ -9,7 +9,15 @@ from fastapi.responses import JSONResponse
|
||||
import os
|
||||
|
||||
from version import APP_VERSION, BUILD_DATE, DB_SCHEMA_VERSION, MODULE_VERSIONS
|
||||
from db_init import init_db
|
||||
|
||||
# Run database migrations on startup
|
||||
try:
|
||||
import run_migrations
|
||||
run_migrations.main()
|
||||
print("✓ Database migrations completed")
|
||||
except Exception as e:
|
||||
print(f"⚠ Warning: Migration error: {e}")
|
||||
print(" Continuing startup - migrations may need manual intervention")
|
||||
|
||||
# Initialize FastAPI app
|
||||
app = FastAPI(
|
||||
@@ -29,8 +37,7 @@ app.add_middleware(
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
# Initialize Database (runs migrations automatically)
|
||||
init_db()
|
||||
# TODO: Initialize Database with migrations
|
||||
|
||||
# Version Endpoint (public, no auth)
|
||||
@app.get("/api/version")
|
||||
|
||||
Reference in new issue
Block a user