Skip to content

Instantly share code, notes, and snippets.

@sshaw sshaw/db.rake
Last active Jun 19, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.