Skip to content

Instantly share code, notes, and snippets.

@moylop260
Created August 21, 2014 20:46
Show Gist options
  • Save moylop260/0fa6a7863833638c593e to your computer and use it in GitHub Desktop.
Save moylop260/0fa6a7863833638c593e to your computer and use it in GitHub Desktop.
--Save out in dropdb.sh and execute with chmod +x
--This delete all database of runbot app
SELECT 'dropdb ' || '"' || datname || '"' AS dropcmd
FROM pg_catalog.pg_database d
WHERE --datname ~ E'^\[0-9]{5}-[\w|\-|.]*' AND
pg_catalog.pg_get_userbyid(d.datdba) = 'runbot'
AND (datname like '%-base' OR datname like '%-all')
ORDER BY 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment