views:

312

answers:

2

I'm developing a plugin for Redmine. How do I create a migration for it?

If I use script/generate plugin_migration, it'll be placed in /db/migrate folder, but I need it to be in my plugin's folder.

A: 

The way most plugins do it (thinking of restful_authentication and others) is to have a generator that needs to be run when you install the plugin. This would generate the migration and put it in db/migrate where it then becomes part of your project migrations. I can't really think of a better way to do this. Using something like desert can help, but adds its own bit of overhead as well.

Jeff Whitmire
+2  A: 

You can use script/generate migration to create the migration and then move it into the plugin directory. When you move it, make sure to change from the timestamped format (20090719...) to the integer format (001_...)

I tend to just create the migrations by hand myself since they are pretty basic.

Eric Davis

Eric Davis