Skip to content

Instantly share code, notes, and snippets.

@conorh
Last active April 19, 2016 01:38
Show Gist options
  • Save conorh/e31b9a7e1e197b68ea01215473b88ab0 to your computer and use it in GitHub Desktop.
Save conorh/e31b9a7e1e197b68ea01215473b88ab0 to your computer and use it in GitHub Desktop.
Cleanup structure.sql file after it is created
Rake::Task["db:structure:dump"].enhance do
path = Rails.root.join('db', 'structure.sql')
file = File.read(path)
file.gsub!(/ AUTO_INCREMENT=\d*/, '')
# remove all comment lines
file.gsub!(/^--.*/,'')
File.write(path, file)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment