I'm thinking about deploying Doctrine migrations in my environment to handle database changes between multiple developers. I haven't used them before, but I have done my research on the matter.
My only concern at this point is that [as far as I can tell] Doctrine migrations don't allow for fixture modifications. While I realize that migrations are for schematic changes, I think fixture changes are just as important.
I would like to have fixtures for the reference tables is my database (ie *_type, *_source, etc), and I feel that row add/delete/updates should be handled by these migrations as well, as they are just as important as any structural change.
If anybody could point me in the right direction here, it would be much appreciated.
Update
I explored the idea of simply letting SVN track my reference table fixtures, but this would be be an undeployable solution. The tables would not be able to be truncated/re-populated due to foreign key constraints.
As you pointed out, migrations are to facilitate structural changes to the database, not for manipulating your fixture data in line with them.
In my experience, using migrations when an application is in development is not necessarily the most helpful way to do it, especially if Developer A creates a new migration and doesn't commit immediately, and Developer B also creates a new migration that (unknowingly) conflicts with Developer A's migration, and then checks in immediately. Developer A checks his (or her) migration soon after, and you have two conflicting migrations and the world explodes.
I'd say the better (albeit more longwinded) way to do it would be to make your schema changes in schema.yml, apply your schema changes (either with a private migration or manually) and then doctrine:data-dump
and commit your fixture data.
If you do opt for migrations in development, perhaps you should consider using the ->postUp()
and ->preUp()
methods of the Doctrine Migration class to transform your data in situ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With