What strategies are folks using to migrate databases for Warbler based
applications?
I’ve found this troublesome in the past because I typically want to run
“rake db:migrate” from my production server, but with Warbler I don’t
necessarily have everything I need (i.e. db/, Rakefile, etc).
I’ve been playing around with the idea of making my WAR file such that I
could run:
java -jar myapp.war -S rake db:migrate
But I forgot how annoying jar inside of jars can be.
Does anyone have suggestions on the best way to approach this? Does
executing the WAR with rake tasks sound worth the effort?
What strategies are folks using to migrate databases for Warbler based
applications?
I’ve found this troublesome in the past because I typically want to run “rake
db:migrate” from my production server, but with Warbler I don’t necessarily have
everything I need (i.e. db/, Rakefile, etc).
The two common strategies I hear about are a) running migrations at
war deployment time with a separate servlet context listener (like 1), and b) unpacking the war contents and including a script to run
rake on the unpacked war. Both require packing your db/migrations
directory inside, obviously.
I’ve been playing around with the idea of making my WAR file such that I could
run:
java -jar myapp.war -S rake db:migrate
But I forgot how annoying jar inside of jars can be.
We’ve wanted to do this for a while too. There’s this ticket (and the
start of some code):
Does anyone have suggestions on the best way to approach this? Does executing
the WAR with rake tasks sound worth the effort?
Definitely. If you feel like helping out, please do!
And I can run rake if use the -f option (i want it to pick up the
Rakefile I put in my WAR file).
You can see what I’m doing here:
I’m still working on getting the WEB-INF/gems dir on the GEM_PATH. And
I have a few other kinks to work out. But I’ll submit a pull request
eventually. Let me know if you have any tips.
Thanks,
-Joe
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.