Last active
June 14, 2016 17:55
-
-
Save adamvaughan/378cb5fa82d7378e184fe34e524c8bca to your computer and use it in GitHub Desktop.
DB Candy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copydb --description 'Copy a remote database locally.' | |
dropdb (dbname $argv)_development | |
createdb (dbname $argv)_development | |
pg_dump -h (dbhost $argv) -U inside_track -d (dbname $argv) | psql -d (dbname $argv)_development -f - | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dbhost | |
echo (echo $argv-db | sed s/-staging-db/-db-staging/).ucoachapp.com | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dbname | |
echo (echo $argv | sed s/-staging//) | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pgr --description 'Connect to a remote PostgreSQL instance.' | |
psql -h (dbhost $argv) -U inside_track -d (dbname $argv) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment