File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -479,10 +479,18 @@ def migrate_csv_to_db():
479479 with sqlite3 .connect (DB_NAME ) as conn :
480480 c = conn .cursor ()
481481
482- # Step 1: Clear existing table
483- c .execute ("DELETE FROM music_clips" )
484-
485- # Step 2: Re-read CSV and insert each entry
482+ # Step 1: Drop and recreate table
483+ c .execute ("DROP TABLE IF EXISTS music_clips" )
484+ c .execute ('''
485+ CREATE TABLE music_clips (
486+ id INTEGER PRIMARY KEY AUTOINCREMENT,
487+ filename TEXT,
488+ title TEXT,
489+ description TEXT
490+ )
491+ ''' )
492+
493+ # Step 2: Insert from CSV
486494 with open (csv_path , encoding = 'utf-8' ) as f :
487495 reader = csv .DictReader (f )
488496 for row in reader :
@@ -498,10 +506,9 @@ def migrate_csv_to_db():
498506 )
499507
500508 conn .commit ()
501- return "✅ Database refreshed from CSV!"
502-
509+ return "✅ Table recreated and data loaded from CSV!"
503510 except Exception as e :
504- return f"❌ Error during migration : { e } "
511+ return f"❌ Error: { e } "
505512
506513# SEARCH ROUTE
507514@app .route ('/search' )
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ primary_region = 'ams'
1919[http_service ]
2020 internal_port = 8080
2121 force_https = true
22- auto_stop_machines = ' stop'
2322 auto_start_machines = true
24- min_machines_running = 0
25- processes = [' app' ]
23+ auto_stop_machines = false
24+ min_machines_running = 1
25+
2626
2727[[vm ]]
2828 memory = ' 1gb'
You can’t perform that action at this time.
0 commit comments