Search code examples
phpdoctrine-ormdoctrine

Is there a way to ask doctrine to propose conservative migrations?


I'm looking for a way to configure doctrine, so any migration proposed will be "conservative". A conservative migration doesn't drop / rename any column or table, so any version of the code can run on the same DB.

I'm looking also a way to create a "breaking change" migration and mark it so anyone could recognize it


Solution

  • As Chris Haas proposed in comment you could use doctrine event system. But I think it's a tough way.

    More straightforward way is to keep those deleted/renamed fields in entity classes and mark them as deprecated until you decide to create "breaking change" migration.