Explorar o código

chore: Remove obsolete dimensions migration script

unknown hai 2 meses
pai
achega
bb579d181e
Modificáronse 3 ficheiros con 2 adicións e 23 borrados
  1. 1 3
      backend/main.py
  2. 0 20
      backend/migrate_dimensions.py
  3. 1 0
      backend/schema.sql

+ 1 - 3
backend/main.py

@@ -22,14 +22,12 @@ 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()
+    print("Application starting up...")
 
 # Configure CORS
 origins = [

+ 0 - 20
backend/migrate_dimensions.py

@@ -1,20 +0,0 @@
-import db
-
-def migrate():
-    print("Migrating database to add dimensions column to order_files...")
-    try:
-        # Check if column exists first using MySQL syntax
-        columns = db.execute_query("SHOW COLUMNS FROM order_files")
-        column_names = [c['Field'] for c in columns]
-        
-        if 'dimensions' not in column_names:
-            db.execute_commit("ALTER TABLE order_files ADD COLUMN dimensions VARCHAR(255)")
-            print("Successfully added 'dimensions' column to 'order_files' table.")
-        else:
-            print("Column 'dimensions' already exists.")
-            
-    except Exception as e:
-        print(f"Migration error: {e}")
-
-if __name__ == "__main__":
-    migrate()

+ 1 - 0
backend/schema.sql

@@ -135,6 +135,7 @@ CREATE TABLE IF NOT EXISTS `order_files` (
   `print_time` varchar(50) DEFAULT NULL,
   `filament_g` float DEFAULT NULL,
   `preview_path` varchar(512) DEFAULT NULL,
+  `dimensions` varchar(255) DEFAULT NULL,
   `created_at` timestamp NULL DEFAULT current_timestamp(),
   PRIMARY KEY (`id`),
   KEY `order_id` (`order_id`),