tchandy/octopus — pull request #143 by ragalie (2013-01-19 21:25:58+00:00)
Title: Store versions in each shard's schema_migrations table

Currently schema version information for all of the shards in an application is stored in the master shard only. This information should be stored in each shard individually, and each shard should execute the migrations necessary to bring it to requested version.

In the event that the schemas of two shards diverge, this change ensures that the divergence is properly recorded and that running `db:migrate` task will correctly migrate the shards to the same version.

## Important Notes

This is a _backwards-incompatible change_. Included is a rake task (`octopus:copy_schema_versions`) that assumes that all shards are at the schema version recorded in the master database. Applications running a previous version of octopus must run this task on update to avoid rerunning previously applied migrations.

This commit breaks Rails 2.3 support due to the use of `ActiveSupport::Concern`. I'm planning on submitting a pull request later today that removes Rails 2.3 support from Octopus. Alternatively, someone else is free to rewrite `Octopus::Migration` to not use `Concern`.

There's a commit in this PR that increments the version number again (this time correctly :smile:) since this is a pretty major change and anyone upgrading to this commit will need to run the included rake task. There's also a commit that adds a post-install message to the gemspec with the relevant information.

Finally, it's pretty well-tested, but I haven't had a chance to actually try it on production databases yet.

Fixes #110, #102, #100, #91