We are in the development phase of a rails app which is hosted as war in GlassFish. Deployment works well, except for the migration part (which requires manual interaction). My question: is it "acceptable" to run migrations upon boot OR by invoking them from within an admin page? Are there better/cleaner alternatives? Thx Clemens --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 13, 6:55 am, Clemens <clemens.w...-7fY5B7ekypAfv37vnLkPlQ@public.gmane.org> wrote:> We are in the development phase of a rails app which is hosted as war > in GlassFish. Deployment works well, except for the migration part > (which requires manual interaction). > > My question: > is it "acceptable" to run migrations upon boot OR by invoking them > from within an admin page?If you ran them from the admin page then at the very least you would need to call reset_column_information on all your model classes (in all instances of your application) Fred> > Are there better/cleaner alternatives? > > Thx > Clemens--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > My question: > > is it "acceptable" to run migrations upon boot OR by invoking them > > from within an admin page? > > If you ran them from the admin page then at the very least you would > need to call reset_column_information on all your model classes (in > all instances of your application) > > FredDear Fred, does this also apply to calling migrations upon boot, or woud that be "safe"? if (ActiveRecord::Migrator.new(:up, ''db/ migrate'').pending_migrations.length > 0) ActiveRecord::Migration.verbose = false ActiveRecord::Migrator.migrate("db/migrate/", nil) end Thx Clemens --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Nov 2008, at 13:55, Clemens wrote:> >>> My question: >>> is it "acceptable" to run migrations upon boot OR by invoking them >>> from within an admin page? >> >> If you ran them from the admin page then at the very least you would >> need to call reset_column_information on all your model classes (in >> all instances of your application) >> >> Fred > Dear Fred, > does this also apply to calling migrations upon boot, or woud that be > "safe"? >Depends what you mean by on boot. Would each instance of the app try and run the migrations ? That would probably result in bad stuff. Fred> if (ActiveRecord::Migrator.new(:up, ''db/ > migrate'').pending_migrations.length > 0) > ActiveRecord::Migration.verbose = false > ActiveRecord::Migrator.migrate("db/migrate/", nil) > end > > Thx > Clemens > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> > Are there better/cleaner alternatives? >run at deploy time IMHO using capistrano, "cap deploy:migrate" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 13, 9:55 am, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Are there better/cleaner alternatives? > > run at deploy time IMHO > > using capistrano, "cap deploy:migrate"and to avoid having to issue more than one cap command for a deploy and migrate, I typically define a task to do it all: namespace :deploy do task :long do web.disable default migrate web.enable end end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Depends what you mean by on boot. Would each instance of the app try > and run the migrations ? That would probably result in bad stuff.didn''t htink about this (mongrel cluster...) ;-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Nov., 15:55, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Are there better/cleaner alternatives? > > run at deploy time IMHO > > using capistrano, "cap deploy:migrate"as mentioned above, deploying the app as a "war" into GlassFish, hence no capistrano... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
you could still write a script that copies the war to the servlet container, restarts it and runs "rake db:migrate RAILS_ENV=whatever" On Nov 13, 12:18 pm, Clemens <clemens.w...-7fY5B7ekypAfv37vnLkPlQ@public.gmane.org> wrote:> On 13 Nov., 15:55, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Are there better/cleaner alternatives? > > > run at deploy time IMHO > > > using capistrano, "cap deploy:migrate" > > as mentioned above, deploying the app as a "war" into GlassFish, hence > no capistrano...--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Nov., 21:11, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you could still write a script that copies the war to the servlet > container, restarts it and runs "rake db:migrate RAILS_ENV=whatever"but all the rails sources are IN the war...? Where should I run rake? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
AFAIK the container expands the war to a directory... find that and cd there On Nov 14, 2:48 am, Clemens <clemens.w...-7fY5B7ekypAfv37vnLkPlQ@public.gmane.org> wrote:> On 13 Nov., 21:11, jemminger <jemmin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you could still write a script that copies the war to the servlet > > container, restarts it and runs "rake db:migrate RAILS_ENV=whatever" > > but all the rails sources are IN the war...? Where should I run rake?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dear Clemens, I tried similar thing, but doesn''t go well because web server doesn''t run without DB tables. How did you handle this issue? Andy On 11月13日, 午後10:55, Clemens <clemens.w...-7fY5B7ekypAfv37vnLkPlQ@public.gmane.org> wrote:> > > My question: > > > is it "acceptable" to run migrations upon boot OR by invoking them > > > from within an admin page? > > > If you ran them from the admin page then at the very least you would > > need to call reset_column_information on all your model classes (in > > all instances of your application) > > > Fred > > Dear Fred, > does this also apply to calling migrations upon boot, or woud that be > "safe"? > > if (ActiveRecord::Migrator.new(:up, ''db/ > migrate'').pending_migrations.length > 0) > ActiveRecord::Migration.verbose = false > ActiveRecord::Migrator.migrate("db/migrate/", nil) > end > > Thx > Clemens--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---