I was talking with someone (I will edit this post when I find her card and remember her name) here at ZendCon and discovered that they were having trouble with migrations in Doctrine. Having gone through the same issues of Doctrine seemingly not being able to figure out your changes and generate migration classes, I thought I’d post the solution here for future reference.
Assuming you have access to the Doctrine CLI tool, the sequence you need is:
- Make the changes to your YAML schema files
- Run
$ doctrine generate-migrations-diffto generate the migration deltas - Run
$ doctrine migrateto determine if your migration deltas are working (a concern if you’re using SQL Server) - Run
$ doctrine generate-models-yamlto update your models to reflect the status of your database
The reasoning behind this, and if I’m wrong someone can correct me, is the “generate-migrations-diff” task compares the differences between your YAML schema files and your current models. If you have updated your models before generating the diff, obviously Doctrine will find no difference and generate no migration delta.