#!/bin/sh DB_NAME="your_database_name" DB_USER="your_username" DB_HOST="your_host" # e.g., localhost or an IP address DB_PORT="your_port" # Default PostgreSQL port is 5432 SQL_FILE="payment_migration.sql" # File containing the SQL script # Check if the SQL file exists if [ ! -f "$SQL_FILE" ]; then echo "Error: SQL file '$SQL_FILE' not found." exit 1 fi # Execute the SQL script psql -h "$DB_HOST" -p "$DB_PORT" -U "$DB_USER" -d "$DB_NAME" -f "$SQL_FILE" # Check the result of the execution if [ $? -eq 0 ]; then echo "SQL script executed successfully." else echo "Error: Failed to execute SQL script." exit 1 fi