|
@@ -8,21 +8,21 @@ echo "========================================================="
|
|
|
echo "🍔 Local Food AI: Extreme Batch Ingestion"
|
|
echo "🍔 Local Food AI: Extreme Batch Ingestion"
|
|
|
echo "========================================================="
|
|
echo "========================================================="
|
|
|
|
|
|
|
|
-if [ ! -f "en.openfoodfacts.org.products.csv" ] && [ ! -f "fr.openfoodfacts.org.products.csv" ]; then
|
|
|
|
|
- echo "❌ Error: CSV files not found in the current directory."
|
|
|
|
|
|
|
+if [ ! -f "data/en.openfoodfacts.org.products.csv" ] && [ ! -f "data/fr.openfoodfacts.org.products.csv" ]; then
|
|
|
|
|
+ echo "❌ Error: CSV files not found in the data/ directory."
|
|
|
echo "Please download the massive CSVs before running this batch."
|
|
echo "Please download the massive CSVs before running this batch."
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-echo "🚀 Starting database wipe and reset..."
|
|
|
|
|
-# Automatically run the new DB setup to drop the rigid table
|
|
|
|
|
-venv/bin/python3 setup_db.py
|
|
|
|
|
|
|
+echo "🚀 Running database migrations to ensure schema health..."
|
|
|
|
|
+# Run database migrations
|
|
|
|
|
+venv/bin/python3 -m alembic upgrade head
|
|
|
|
|
|
|
|
echo "🚀 Triggering background ingestion process via nohup..."
|
|
echo "🚀 Triggering background ingestion process via nohup..."
|
|
|
echo "All outputs will be saved to ingestion_process.log"
|
|
echo "All outputs will be saved to ingestion_process.log"
|
|
|
|
|
|
|
|
-# Run securely in background
|
|
|
|
|
-nohup venv/bin/python3 -u ingest_csv.py > ingestion_process.log 2>&1 &
|
|
|
|
|
|
|
+# Run securely in background with --wipe flag to clean products database
|
|
|
|
|
+nohup venv/bin/python3 -u ingest_csv.py --wipe > ingestion_process.log 2>&1 &
|
|
|
BG_PID=$!
|
|
BG_PID=$!
|
|
|
|
|
|
|
|
echo "✅ Process started in the background (PID: $BG_PID)"
|
|
echo "✅ Process started in the background (PID: $BG_PID)"
|