views:

30

answers:

1

Our team is developing a Rails app on MySQL and using config.active_record.schema_format = :sql per The Rails Guides.

Naturally, our AUTO_INCREMENT values in development_structure.sql get out-of-sync as we develop in parallel. We know that having different values in our databases for AUTO_INCREMENT is not a technical problem. However, it creates a lot of diff noise when we diff before checking-in. On more than one occasion we have broken our build because one of us missed an important change in development_structure.sql that was disguised by all the noise.

Any suggestions on how to eliminate this diff noise so our eyes can focus on important changes?

Thanks.

A: 

At Razoo, we ended up overriding db:migrate

task :migrate do
  Rake::Task['db:migrate'].invoke
  Rake::Task['db:structure:dump'].invoke
end

and then db:structure:dump

namespace :structure do
  desc "Dump the database structure to a SQL file"
    task :dump do
      Rake::Task['db:structure:dump'].invoke
      # open up the development_structure.sql file and gsub AUTO_INCREMENT=\d* with AUTO_INCREMENT
    end
  end
end
Ian Lotinsky