Skip to content

Instantly share code, notes, and snippets.

@sshaw
Last active June 19, 2018 04:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sshaw/b60054aafc2c7cfbea36b5e5e03e39a2 to your computer and use it in GitHub Desktop.
Save sshaw/b60054aafc2c7cfbea36b5e5e03e39a2 to your computer and use it in GitHub Desktop.
Remove MySQL AUTO_INCREMENT From Rails db:structure:dump
namespace :db do
namespace :structure do
task :dump => :environment do
# Can add more dump options to ~/.my.cnf:
#
# [mysqldump]
# skip-comments
#
command = %q{perl -i -pe's/AUTO_INCREMENT=\d+\s//' %s} % Rails.root.join("db/structure.sql")
sh command, :verbose => false do |ok, res|
abort "failed to remove AUTO_INCREMENT: #{res}" if !ok
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment