PHP - Database schema: version control, branching, migrations PHP - Database schema: version control, branching, migrations php php

PHP - Database schema: version control, branching, migrations


Well, I wasn't able to find any reason not to move forward.

The project, such as it is, is here:

http://github.com/Billiam/MySQL-PHP-AutoMigrations

Needs some love (accurate comments, unit testing, actual bug testing), but seems to be working well for me now.

It's a fork of http://code.google.com/p/mysql-php-migrations/ to include the ideas above, and some other little stuff.

Migrating down is done from methods saved in the database on the way up so that file changes (like those when switching between branches) do not affect downward migrations.Added two functions:

  • a magic 'auto' function that handles migrating down to the oldest shared migration, and then up to the newest migration in the migrations directory.
  • 'propose' function that shows what auto will actually do.

Still very open to hearing potential (or even expected) pitfalls from this approach however.