54 lines
1.8 KiB
Bash
Executable File
54 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Script to restore sync_status column in all_repositories table
|
|
# This fixes the issue where the column was removed but is still used in the codebase
|
|
|
|
echo "=========================================="
|
|
echo "Restoring sync_status Column Migration"
|
|
echo "=========================================="
|
|
echo ""
|
|
|
|
# Database connection parameters
|
|
DB_HOST="${POSTGRES_HOST:-localhost}"
|
|
DB_PORT="${POSTGRES_PORT:-5432}"
|
|
DB_NAME="${POSTGRES_DB:-dev_pipeline}"
|
|
DB_USER="${POSTGRES_USER:-pipeline_admin}"
|
|
DB_PASSWORD="${POSTGRES_PASSWORD:-secure_pipeline_2024}"
|
|
|
|
echo "Database Configuration:"
|
|
echo " Host: $DB_HOST"
|
|
echo " Port: $DB_PORT"
|
|
echo " Database: $DB_NAME"
|
|
echo " User: $DB_USER"
|
|
echo ""
|
|
|
|
# Check if running inside Docker container
|
|
if [ -f /.dockerenv ]; then
|
|
echo "Running inside Docker container"
|
|
PGPASSWORD="$DB_PASSWORD" psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -f src/migrations/023_restore_sync_status_column.sql
|
|
else
|
|
echo "Running outside Docker - using docker exec"
|
|
docker exec -i pipeline_postgres psql -U "$DB_USER" -d "$DB_NAME" < src/migrations/023_restore_sync_status_column.sql
|
|
fi
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "✅ Migration completed successfully!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "The sync_status column has been restored to the all_repositories table."
|
|
echo "All existing repositories have been updated with appropriate sync_status values."
|
|
echo ""
|
|
else
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "❌ Migration failed!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Please check the error messages above and try again."
|
|
echo ""
|
|
exit 1
|
|
fi
|
|
|