Migrations in Rails Engine?

Mike picture Mike · Dec 24, 2010 · Viewed 21k times · Source

I have multiple rails applications talking to the same backend and I'd like them to share some migrations.
I setup a rails engine (with enginex), I can share anything (controllers, views, models,...) but no migrations. I can't make it work !

I tried to create a file db/migrate/my_migration.rb but in my main application if I do :

  rake db:migrate

It doesn't load them.

After some googling it appears there was some recent work on this and it seems this has been merge to rails master. I'm with rails 3.0.3 do you see any way to make this work ?

Thanks !

Answer

Jais picture Jais · Nov 7, 2011

In rails 3.1, you can do it using this command, give that your engine name is example:

# Note that you append _engine to the name
rake example_engine:install:migrations