Re: Question about how engine plugin handlesmigrations

Plugin Migrations have their own version history. Their version numbers
are kept in a table called ‘plugin_schema_info’, which has 1 row per
plugin with migrations.

The script/generate plugin_migration generates client migrations that
place themselves sequentially at the end of the client migrations. So
in your example, the newly added core_wiki migration would get copied
into the client my_custom_wiki but would be numbered as client migration

The script/generate plugin_migration uses the plugin_schema_info version
number associated with core_wiki to see how far your client has already
been migrated and then copies the un-executed migrations to the client.

Actually it doesn’t copy them, it puts a placeholder migration that just
calls the migration on the plugin class, like:

class CoreWikiToVersion7 < ActiveRecord::Migration
def self.up
def self.down

However, I do believe that if you have copied migrations (such as this)
to the client previously, but not executed them yet, and run
script/generate plugin_migrations again you will get extra copies. I
haven’t verified this though.

Trevor Rowe


Thanks a lot - helpful info there. I through together a
proof-of-concept to verify and it’s all working as I’d expect. I’m
pleasantly surprised.

Thanks again.