Plugins - custom_migrator
Add to favoritesCustomMigrator
Installing
ruby script/plugin install http://custommigrator.rubyforge.org/svn/plugins/custom_migrator
What does it do?
Custom migrator is an alternate migration tool for rails migrations which is multi-developer environment friendly.
The custom migrator uses a different scheme for db rails migrations. It deals with three artifacts, 1) migration_list.yml, 2) migrations_bookmark table in the database, and 3) migration files.
migration_list.yml
It maintains a master list file called migration_list.yml which contains an ordered list of migration file names. For example, for the contents in db/migration directory
db/migration
* create_user.rb
* create_account.rb
* create_employee.rb
* migration_list.yml
contents of migration_list.yml
---
- create_user.rb
- create_account.rb
- create_employee.rb
The order is based on the sequence of migrations creation using ruby script/generation migration [migrationName] command.
migrations_bookmark table
This is the table automatically created (if not present already) before running migrations. This contains one column called book_mark and at any point of time it will have 0 or 1 rows. The value will be file name of a migration.
migrations
These are similar to the standard rails migration files, but don’t contain numbers or timestamps in the file names.
What Problems Does it Solve?
Version number Collision
The regular rails migrations scheme is not multi-developer friendly, for example it doesn’t prevent or help in preventing the following scenario.
Lets say there are two developers John and Scott who are working on the foo rails application and they are using some source code control system. Lets say the foo application currently contains 3 migrations. Now, both John and Scott try to create migrations concurrently on their machines (which also has independent database).
1) John creates a migration which will get the version number 4 2) Scott also creates a migration on his machine which also gets the version number 4 3) Both check in their migration into the source code control system with duplicate verison numbers (4).
Resource Conflicts
This occurs when say John creates a migration to delete the foo table and Scott creates a migration to add a column to the foo table.
How are the above Problems Solved?
The custom migrator maintains migration_list.yml master list file which needs to be checked out and checked in for updates from and into the source code control system. When two or more developers try to modify and try to check in at the same time, source code control system will show conflicts and requests the user to resolve them. So the developers will get a chance to review the migration_list.yml closely and correct it if required and check in to the SCCS.
Problems
If the contents of migration_list.yml are re-arranged then there may be a problem of data consistency.
Copyright © 2008 [Babu Naidu], released under the MIT license
http://rubyforge.org/projects/custommigrator/
http://custommigrator.rubyforge.org/svn/plugins/custom_migrator/
Rails' (MIT)
Misc. Enhancements
