소스 검색

fix: add automatic DB migration on startup to fix missing dimensions column

unknown 2 달 전
부모
커밋
e785c812ea
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      backend/main.py

+ 6 - 0
backend/main.py

@@ -22,9 +22,15 @@ import locales
 import config
 import db
 from routers import auth, orders, catalog, portfolio, files, chat, blog, admin, contact, warehouse
+import migrate_dimensions
 
 app = FastAPI(title="Radionica 3D API")
 
+@app.on_event("startup")
+async def startup_event():
+    print("Running startup migrations...")
+    migrate_dimensions.migrate()
+
 # Configure CORS
 origins = [
     "http://localhost:5173",