Running rake db:migrate without some initializers
I am trying to run jruby -S rake db:migrate
, but I do not want to start up a daemon in config/initializers
whenever I do a migrate. Is there a way to do this? Up 开发者_如何学Gountil now, I have just been moving the daemon file to a file with a .bak extension so that rails doesn't load it when I do the migrate.
I suspect that this is a stupid way of doing things. Is there a better way?
Oh and I am running jruby
( if it matters ).
When run:
NODAEMON=1 rake db:migrate
In initializer:
unless ENV['NODAEMON']
# ...
end
You can also create separate task for setting NODAEMON, e.g.
task :fast_migrate do
ENV['NODAEMON'] = '1' # or just set global variable, or some config
Rake['db:migrate'].invoke
end
精彩评论