rmk
rmk

Reputation: 4455

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

Upvotes: 1

Views: 1696

Answers (1)

valodzka
valodzka

Reputation: 5805

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

Upvotes: 4

Related Questions