Эх сурвалжийг харах

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

unknown 2 сар өмнө
parent
commit
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",