# MySQL Credentials
MYSQL_USER="ftgstage_wp238"
MYSQL_PASSWORD="Y4kS.4p-1I"
MYSQL_DATABASE="ftgstage_wp238"

# Loop through each .sql file in the current directory
for sql_file in *.sql;
do
    # Check if the file is actually a file (not a directory)
    if [ -f "$sql_file" ]; then
        echo "Executing $sql_file..."
        
        # Execute the SQL file using MySQL client
        mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE" < "$sql_file"
        
        # Check the exit status of the mysql command
        if [ $? -eq 0 ]; then
            echo "Execution of $sql_file completed successfully."
        else
            echo "Error: Execution of $sql_file failed."
        fi
    fi
done