Skip to content

Instantly share code, notes, and snippets.

@jakesorce
Created February 4, 2013 20:24
Show Gist options
  • Save jakesorce/4709443 to your computer and use it in GitHub Desktop.
Save jakesorce/4709443 to your computer and use it in GitHub Desktop.
kill connections commands
drop_command = "select pg_terminate_backend(procpid) from pg_stat_activity where datname='canvas_development';"
drop_command_queue = "select pg_terminate_backend(procpid) from pg_stat_activity where datname='canvas_queue_development';"
system("sudo -u postgres psql -c \"#{drop_command}\"")
system("sudo -u postgres psql -c \"#{drop_command_queue}\"")
system("psql -U canvas -c 'drop database canvas_development;'")
system("psql -U canvas -c 'create database canvas_development;'")
create_pg_extension
system("psql -U canvas -c 'drop database canvas_queue_development;'")
system("psql -U canvas -c 'create database canvas_queue_development;'")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment