Forum: Ruby on Rails How to add a migration with a plugin?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Berin L. (Guest)
on 2006-05-25 17:36
(Received via mailing list)
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:* removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>
*IM:* removed_email_address@domain.invalid (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+Fo...
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/>
Kevin O. (Guest)
on 2006-05-25 21:47
(Received via mailing list)
On Thursday, May 25, 2006, at 9:34 AM, Berin L. wrote:
>	*Email:* removed_email_address@domain.invalid 
<mailto:removed_email_address@domain.invalid>
>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
>removed_email_address@domain.invalid
>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
Ezra Z. (Guest)
on 2006-05-25 23:57
(Received via mailing list)
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
Berin L. (Guest)
on 2006-05-26 07:19
(Received via mailing list)
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?
Kevin O. (Guest)
on 2006-05-26 17:10
(Received via mailing list)
On Thursday, May 25, 2006, at 11:17 PM, Berin L. wrote:
>> telling the user to run a custom rake task.
>
>_______________________________________________
>Rails mailing list
>removed_email_address@domain.invalid
>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
This topic is locked and can not be replied to.