Last active
June 19, 2018 04:52
-
-
Save sshaw/b60054aafc2c7cfbea36b5e5e03e39a2 to your computer and use it in GitHub Desktop.
Remove MySQL AUTO_INCREMENT From Rails db:structure:dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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