Prev | Current Page 456 | Next

Brad Ediger

"Advanced Rails"

However, this does not eliminate the need to
migrate down and back up when several migrations have been applied to a database;
the plugin will not search old version numbers (older than the current version) for
new migrations.
My solution, Subverted Migrations,* is more complicated, but it aims to be as transparent
as possible once you understand it. As the name suggests, it only works with
Subversion. The intent is to synchronize version numbers across all branches. That
way, all developers and all branches have the same view of the migrations that have
been applied project-wide. It applies two changes to the Rails version-numbering
mechanism:
??? It serializes version numbers across all branches by scanning the Subversion
repository for all branches to find a free version number.
??? It changes the semantics of the schema_version table: rather than being the number
of the latest-applied migration, the schema version is a list of migrations that
have been applied to the database. When older changes from other branches are
merged in, a simple rake db:migrate applies them without the need to migrate
down and up.
* http://www.bradediger.com/blog/2006/11/subverted_migrations.html
308 | Chapter 10: Large Projects
Of course, this only works if all developers promptly check in their new migrations,
and if the migrations are truly independent from each other in the first place.


Pages:
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468