How do I disable the migrations feature in a Rails app?
database-design, oop, rails-activerecord, rails-migrations, ruby-on-rails
Solution
This came up again when testing finally came to the front. Thus, I took deeper look and came up with the following thanks, in part, to the comments left on the question. This removes all rake DB capabilities and tests still run fine. (In case anyone is wondering, we clone the test DB from elsewhere when we need to refresh it.)
Add this to the `Rakefile`:
# Disable DB migrations, DB test preparing, etc.
Rake::Task.tasks.each do |t|
if t.name[0,3] == "db:"
t.clear
t.add_description("!!! Disabled in favor of enterprise design at Acme.")
end
end
Comment out all the fixtures in `test/test_helper.rb`:
#fixtures :all
Problem
Background We engineer database models and application models separately (RDMBS architects vs OOP engineers). From what I've seen regarding Rails versus domain/key normal form, Rails migrations cannot easily duplicate all the features of a well-designed enterprise RDBMS (if at all) so we don't migrate and instead use other tools to build databases (nevermind the problem of object-relational impedance mismatch). Data integrity and DB performance are too valuable to us to risk RDBMS model changes by any developer. Question For whatever reason, we now have a Rails app that has made damaging DB changes through migrations. How do I cleanly disable this feature in an existing Rails application? I have my theories but I want to know what the world thinks.