Files
ruflo/docs/ruvector-postgres/scripts/run-migrations.sh
T
rUvandClaude Opus 4.5 ac990a2ad2 Checkpoint: File edits
Automatic checkpoint created by Claude Code
- Branch: main
- Timestamp: 2026-01-17T20:27:02Z
- Changes: 1 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 20:27:02 +00:00

60 lines
1.6 KiB
Bash

#!/bin/bash
# Run RuVector PostgreSQL migrations
set -e
HOST="${PGHOST:-localhost}"
PORT="${PGPORT:-5432}"
DATABASE="${PGDATABASE:-claude_flow}"
USER="${PGUSER:-claude}"
PASSWORD="${PGPASSWORD:-claude-flow-test}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
MIGRATIONS_DIR="$PROJECT_ROOT/v3/@claude-flow/plugins/src/integrations/ruvector/migrations"
echo "🚀 Running RuVector PostgreSQL Migrations"
echo "=========================================="
echo ""
echo "Host: $HOST:$PORT"
echo "Database: $DATABASE"
echo "User: $USER"
echo "Migrations: $MIGRATIONS_DIR"
echo ""
# Check if migrations directory exists
if [ ! -d "$MIGRATIONS_DIR" ]; then
echo "❌ Migrations directory not found: $MIGRATIONS_DIR"
echo ""
echo "Trying to use CLI instead..."
npx claude-flow@alpha ruvector migrate \
--host $HOST \
--port $PORT \
--database $DATABASE \
--user $USER \
--up
exit $?
fi
# Run each migration in order
for migration in $(ls -1 "$MIGRATIONS_DIR"/*.sql 2>/dev/null | sort); do
filename=$(basename "$migration")
echo "📄 Running: $filename"
PGPASSWORD=$PASSWORD psql -h $HOST -p $PORT -U $USER -d $DATABASE -f "$migration" 2>&1 | \
grep -v "^$" | while read line; do
echo " $line"
done
if [ ${PIPESTATUS[0]} -eq 0 ]; then
echo " ✅ Complete"
else
echo " ❌ Failed"
exit 1
fi
echo ""
done
echo "=========================================="
echo "✅ All migrations complete!"