Fix null bu_teams in postgres migration, add retry logic to deploy script

This commit is contained in:
Jordan Ramos
2026-05-07 13:28:19 -06:00
parent 1b8790ff16
commit 3db84a377b
3 changed files with 50 additions and 4 deletions

View File

@@ -88,7 +88,16 @@ echo "✓ Dependencies installed"
echo ""
echo "── Step 5: Running data migration (SQLite → Postgres) ──"
if [ -f backend/cve_database.db ]; then
node backend/scripts/migrate-to-postgres.js
if ! node backend/scripts/migrate-to-postgres.js; then
echo ""
echo "⚠ Migration failed — resetting database and retrying..."
PGPASSWORD=sV4xmC9xAUCFop0ypxMVS056QgPqGrX psql -h localhost -p 5433 -U steam -d cve_dashboard -c "
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
" >/dev/null 2>&1
echo "✓ Schema reset"
node backend/scripts/migrate-to-postgres.js
fi
else
echo "⚠ No SQLite database found — skipping migration (fresh install)"
fi