Problems with Doctrine migrations

Problem:

Customer is e.g @ revision 1234 + migration 53.

Now we write a new migration (e.g. 54) which concerns any UllUser (e.g. getting a UllUser via Doctrine::getTable to create a group membership)

Commit as r1235

Now we add a column e.g. "is_show_in_phonebook" to UllUser in the schema.

We write another new migration (e.g. 55) to add the new column at the customer installations.

Commit as r1236 (This should be done in the same commit) 

Now the customer is stil @ r1234 + migration 53.

What happens now if we update the customer?

  1. The files are updated to r1236 which contain the modified UllUser model with the new column
  2. Then the migrations are executed:
    1. migration 54: create group membership
      -> FAILS with msg
      SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u.is_show_in_phonebook' in 'field list'
      because the column is only created in the next migration.

So the problem is the miss-match between model classes (in svn revisions) and database versions (migrations).

 

Solution?

Previously: Use dbh (direct queries)

Currently: separation in multiple migrations. First all "schema" migrations are executed, than the "data" migrations.

See http://www.ullright.org/ullWiki/show/migrations-in-ullright for details

Old Stuff

A possible solution would be to connect revisions and migrations. A prototyp has been implemented in "SvnUpdateStepsTask.class.php", but it has performance problems and needs further refinements