#!/bin/bash # Run database migration as postgres user MIGRATION_FILE="$1" if [ -z "$MIGRATION_FILE" ]; then echo "Usage: ./run-migration.sh " exit 1 fi if [ ! -f "$MIGRATION_FILE" ]; then echo "Error: Migration file not found: $MIGRATION_FILE" exit 1 fi echo "🔐 Running migration as database owner..." echo "📁 Migration file: $MIGRATION_FILE" echo "" sudo -u postgres psql -d skyartshop -f "$MIGRATION_FILE" if [ $? -eq 0 ]; then echo "" echo "✅ Migration completed successfully!" else echo "" echo "❌ Migration failed!" exit 1 fi