How to add a migration with a plugin?

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 L.
Owner

Work: 571-215-7708
Email: [email protected] mailto:[email protected]
IM: [email protected] (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/

On Thursday, May 25, 2006, at 9:34 AM, Berin L. wrote:

Email: [email protected] mailto:[email protected]
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
[email protected]
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

Kevin O. wrote:

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 May 25, 2006, at 10:42 AM, Kevin O. wrote:

Berin L.
maps?q=20044+Great+Falls+Forest+Dr.%2CGreat+Falls%2CVA+22066%

_Kevin

You 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

On Thursday, May 25, 2006, at 11:17 PM, Berin L. wrote:

telling the user to run a custom rake task.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Your approach sounds reasonable, your migration should be the highest
numbered migration, and you should probably know the name part of the
filename.

_Kevin