views:

36

answers:

1

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 until 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 ).

+1  A: 

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
valodzka