I''m working on a plugin that requires some database support to do its job (adding a model or two). I''d like the plugin to automatically add a migration once it is installed. Is there already a mechanism for this? If so, how do you do it? -- *Berin Loritsch* Owner *Work:* 571-215-7708 *Email:* bloritsch@d-haven.com <mailto:bloritsch@d-haven.com> *IM:* bloritsch@d-haven.org (MSN) *http://www.linkedin.com/in/bloritsch * * * *D-Haven* <http://d-haven.org> 20044 Great Falls Forest Dr. <http://maps.google.com/maps?q=20044+Great+Falls+Forest+Dr.%2CGreat+Falls%2CVA+22066%2CUSA&hl=en> Great Falls, VA 22066 USA See who we know in common <http://www.linkedin.com/e/wwk/5678360/> Want a signature like this? <http://www.linkedin.com/e/sig/5678360/> -------------- next part -------------- Skipped content of type multipart/related
On Thursday, May 25, 2006, at 9:34 AM, Berin Loritsch wrote:>I''m working on a plugin that requires some database support to do its >job (adding a model or two). I''d like the plugin to automatically add a >migration once it is installed. Is there already a mechanism for this? >If so, how do you do it? > >-- >*Berin Loritsch* >Owner > >*Work:* 571-215-7708 > *Email:* bloritsch@d-haven.com <mailto:bloritsch@d-haven.com> >*IM:* bloritsch@d-haven.org (MSN) >*http://www.linkedin.com/in/bloritsch >* >* * *D-Haven* <http://d-haven.org> >20044 Great Falls Forest Dr. ><http://maps.google.com/ >maps?q=20044+Great+Falls+Forest+Dr.%2CGreat+Falls%2CVA+22066%2CUSA&hl=en> >Great Falls, VA 22066 >USA > >See who we know in common <http://www.linkedin.com/e/wwk/5678360/> Want >a signature like this? <http://www.linkedin.com/e/sig/5678360/> > > > > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails >Plugins will call files name ''install.eb'' when installed. I wouldn''t force it to run the migration, but you could have it generate a message telling the user to run a custom rake task. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
On May 25, 2006, at 10:42 AM, Kevin Olbrich wrote:> > On Thursday, May 25, 2006, at 9:34 AM, Berin Loritsch wrote: >> I''m working on a plugin that requires some database support to do its >> job (adding a model or two). I''d like the plugin to automatically >> add a >> migration once it is installed. Is there already a mechanism for >> this? >> If so, how do you do it? >> >> -- >> *Berin Loritsch* >> Owner >> >> *Work:* 571-215-7708 >> *Email:* bloritsch@d-haven.com <mailto:bloritsch@d-haven.com> >> *IM:* bloritsch@d-haven.org (MSN) >> *http://www.linkedin.com/in/bloritsch >> * >> * * *D-Haven* <http://d-haven.org> >> 20044 Great Falls Forest Dr. >> <http://maps.google.com/ >> maps?q=20044+Great+Falls+Forest+Dr.%2CGreat+Falls%2CVA+22066% >> 2CUSA&hl=en> >> Great Falls, VA 22066 >> USA >> >> See who we know in common <http://www.linkedin.com/e/wwk/5678360/> >> Want >> a signature like this? <http://www.linkedin.com/e/sig/5678360/> >> >> >> >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > > Plugins will call files name ''install.eb'' when installed. I wouldn''t > force it to run the migration, but you could have it generate a > message > telling the user to run a custom rake task. > > _KevinYou might want to have a look at the acts_as_authenticated plugin. It uses a simple generator to create a migration. So after you install the plugin, you can run a script/generate command to have it generate the migration file. Cheers- -Ezra
Kevin Olbrich wrote:> On Thursday, May 25, 2006, at 9:34 AM, Berin Loritsch wrote: > >> I''m working on a plugin that requires some database support to do its >> job (adding a model or two). I''d like the plugin to automatically add a >> migration once it is installed. Is there already a mechanism for this? >> If so, how do you do it? >> > Plugins will call files name ''install.eb'' when installed. I wouldn''t > force it to run the migration, but you could have it generate a message > telling the user to run a custom rake task. >My interest is in generating the migration automatically. I leave it to the user to execute the ''rake migrate'' command. So if I call the "generate migration" script using install.rb and then populate the contents with what I have, everything will be good? Of course, the question is how do I know the exact filename? Does generate migration provide any feedback I can parse for that purpose?
On Thursday, May 25, 2006, at 11:17 PM, Berin Loritsch wrote:>Kevin Olbrich wrote: >> On Thursday, May 25, 2006, at 9:34 AM, Berin Loritsch wrote: >> >>> I''m working on a plugin that requires some database support to do its >>> job (adding a model or two). I''d like the plugin to automatically add a >>> migration once it is installed. Is there already a mechanism for this? >>> If so, how do you do it? >>> >> Plugins will call files name ''install.eb'' when installed. I wouldn''t >> force it to run the migration, but you could have it generate a message >> telling the user to run a custom rake task. >> >My interest is in generating the migration automatically. I leave it to >the user to execute the ''rake migrate'' command. So if I call the >"generate migration" script using install.rb and then populate the >contents with what I have, everything will be good? > >Of course, the question is how do I know the exact filename? Does >generate migration provide any feedback I can parse for that purpose? > > > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/railsYour approach sounds reasonable, your migration should be the highest numbered migration, and you should probably know the name part of the filename. _Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.