Skip to content

Instantly share code, notes, and snippets.

@frankpinto
Created July 18, 2014 17:22
Show Gist options
  • Save frankpinto/3427cf769a72ef25ffac to your computer and use it in GitHub Desktop.
Save frankpinto/3427cf769a72ef25ffac to your computer and use it in GitHub Desktop.
Wrapper script used to run sql scripts across environments
#!/usr/bin/env bash
if [ $ENVIRONMENT = 'development' ]; then
psql ayalo_dev postgres < script.sql;
elif [ $ENVIRONMENT = 'beta' ]; then
PGPASSWORD=scrubbed psql -h scrubbed --port 5432 ayalo_dev postgres < script.sql
elif [ $ENVIRONMENT = 'production' ]; then
PGPASSWORD=scrubbed psql -h scrubbed --port 5492 scrubbed scrubbed < script.sql
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment