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.
C941170ba5ca038b89b8407c83fb23c2?d=identicon&s=25 Berin Loritsch (Guest)
on 2006-05-25 15: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 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+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/>
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-05-25 19:47
(Received via mailing list)
On Thursday, May 25, 2006, at 9:34 AM, Berin Loritsch wrote:
>	*Email:* bloritsch@d-haven.com <mailto:bloritsch@d-haven.com>
>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
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-05-25 21:57
(Received via mailing list)
On May 25, 2006, at 10:42 AM, Kevin Olbrich wrote:

>> *Berin Loritsch*
>> 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
C941170ba5ca038b89b8407c83fb23c2?d=identicon&s=25 Berin Loritsch (Guest)
on 2006-05-26 05:19
(Received via mailing list)
Kevin Olbrich 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?
5d15c6821f3c3054c04b85471824ba7c?d=identicon&s=25 Kevin Olbrich (Guest)
on 2006-05-26 15:10
(Received via mailing list)
On Thursday, May 25, 2006, at 11:17 PM, Berin Loritsch wrote:
>> telling the user to run a custom rake task.
>
>_______________________________________________
>Rails mailing list
>Rails@lists.rubyonrails.org
>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.