Backport `rake db:structure:dump`

https://rails.lighthouseapp.com/projects/8994/tickets/5889
https://gist.github.com/AquaGeek/971720
Merge pull request #1 from square/dump-sql-structure

Backport `rake db:structure:dump`