I'm trying to perform a migrations diff between the schema yaml file and my database, using the following code
$migration = new Doctrine_Migration($migrationsPath);
$diff = new Doctrine_Migration_Diff(null, $yamlSchemaPath, $migration);
$changes = $diff->generateMigrationClasses();
$numChanges = count($changes, true) - count($changes);
From what I gather, $from = null here would imply that the from in comparison will be read from the database, but that does not seem to be the case.
Reading about it here i've performed the following steps to make sure the basic routine is not at fault.
- Change yaml file
- generate-migrations-diff to diff your current (changed) yaml with your (unchanged) models. This will generate a migrations file in your doctrine/migrations directory (or whatever migrations_path is set to in your doctrine config).
- migrate to run the migration created in step 2 and modify your database
- generate-models-yaml to generate new classes based on your yaml file. These go where you've specified your generated models go (models_path in your doctrine config).
- generate-sql to generate a SQL file. This will go where your doctrine sql_path config is set to.
The $numChanges is always the same when the schema yaml file isn't changed. It does not compare against the current database that is in sync and working.
Can someone spot an error or perhaps tell me the correct way of doing it?