Trac

Changeset 4618 for branches/0.10

Show
Ignore:
Timestamp:
07/02/08 13:58:04 (5 months ago)
Author:
bascht
Message:
  • copied my addition from trunk
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/0.10/manual/docs/en/migration.txt

    r4139 r4618  
    124124 
    125125This functionality is can also be accessed from the Doctrine command line interface. 
     126 
     127If you had to migrate a few steps down, you might get stuck between two migration steps if your model is out of sync with your table. 
     128Assume that migration step 3 adds a new attribute to your model - and step 2 tries to access that model, you cannot migrate to step 3, because the table doesn't know about the new attribute:  
     129<code type="php"> 
     130$migration = new Doctrine_Migration('/path/to/migration_classes'); 
     131 
     132// Current version is 3 
     133echo $migration->getCurrentVersion(); // 3 
     134 
     135$migration->migrate(0); // takes you from 3 to 0 
     136$migration->migrate(3); // should take you from 0 to 3 but might throw an error if your model is out of sync 
     137 
     138echo $migration->getCurrentVersion(); // 1 
     139</code> 
     140 
     141A simple workaround is to comment out the new attribute in your model file, migrate up stepwise and uncomment the attribute, when you're done.