The doctrine of migration. fittings

I am thinking of deploying Doctrine migration in my environment to handle database changes between multiple developers. I have not used them before, but I did my research on this.

My only problem in this matter is that [as far as I can tell,] Doctrine migrations do not allow device modifications. Although I understand that migrations are intended for schematic changes, I think that changes in equipment are just as important.

I would like to have fixtures for reference tables, this is my database (i.e. * _type, * _source, etc.), and I feel that these additions should also be handled by row add / delete / updates, as they are just the same important, like any structural changes.

If anyone could point me in the right direction here, that would be very grateful.

Update

I explored the idea of ​​just letting SVN keep track of my anchor table bindings, but that would be an insoluble solution. Tables cannot be truncated / re-populated due to foreign key restrictions.

+4
source share
1 answer

As you pointed out, migrations are intended to facilitate structural changes in the database, and not to manage your device data in accordance with them.

In my experience, using migrations when an application is under development is not necessarily the most useful way to execute it, especially if Developer A creates a new migration and does not commit immediately, and Developer B also creates a new migration that (unconsciously) conflicts with the developer. Transfer, and then an immediate check is performed. Developer A checks his (or her) migration shortly afterwards, and you have two conflicting migrations and the world explodes.

I would say that the best (though longer) way to do this is to make your schema changes in schema.yml, apply the schema changes (either via private migration, or manually), and then doctrine:data-dump and commit your device data.

If you chose migration in development, perhaps you should use the ->postUp() and ->preUp() of the Doctrine Migration class to transform your data in place.

+2
source

All Articles