Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save 0x000def42/0af491570bd3b237149dd002c129ca05 to your computer and use it in GitHub Desktop.
Save 0x000def42/0af491570bd3b237149dd002c129ca05 to your computer and use it in GitHub Desktop.
ActiveRecord::Base.connection.execute('select \'drop table "\' || tablename || \'" cascade;\' from pg_tables where schemaname = \'public\'').to_a.map{|e| e.values[0]}.each {|stmt| ActiveRecord::Base.connection.execute(stmt)}
@0x000def42
Copy link
Author

It's can be executed under rails c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment