doctrine / migrations

Doctrine Database Migrations Library
https://www.doctrine-project.org/projects/migrations.html
MIT License
4.68k stars 386 forks source link

Please throw a warning/exception if `addSql` is used in post methods. #1431

Closed VincentLanglet closed 3 months ago

VincentLanglet commented 4 months ago

Hi, I'd like to kinda restart the discussion in https://github.com/doctrine/migrations/issues/369 (cc @stof).

I just encounter a production bug because I wrote a migration with a addSql call in a postUp migration and it wasn't executed.

I understand there are reason for not rewriting the DbalExecutor in order to supports addSql calls in post methods. But in this case would it be possible to throw an error when such call are made ?

In my case such exception would have been thrown locally and/or on my CI and I would have fix the issue before it was deployed in production.

derrabus commented 4 months ago

I would be open to that. Can you prepare a PR that we can discuss on?

VincentLanglet commented 4 months ago

I would be open to that. Can you prepare a PR that we can discuss on?

Sure, I proposed an implementation here https://github.com/doctrine/migrations/pull/1432