Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable schema modification before comparison #10208

Open
derrabus opened this issue Nov 7, 2022 · 2 comments
Open

Enable schema modification before comparison #10208

derrabus opened this issue Nov 7, 2022 · 2 comments

Comments

@derrabus
Copy link
Member

derrabus commented Nov 7, 2022

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

In doctrine/dbal#5784, the event system of the DBAL has been deprecated. In ORM projects, the DBAL events were often used to modify the schema that the ORM generated, before it was compared to the current database. Possible use-cases are:

  • Injecting additional tables that are not managed by the ORM.
  • Adding unmapped columns to tables.
  • Replacing mapped tabled with views.
  • Adding triggers and other elements the ORM does not care about.

I think, we should create such a hook in the ORM, which would allow projects to migrate away from DBAL's event system.

@derrabus derrabus added this to the 2.14.0 milestone Nov 7, 2022
@stof
Copy link
Member

stof commented Nov 7, 2022

The ORM already triggers \Doctrine\ORM\Tools\ToolEvents::postGenerateSchema to let event listeners modify the schema exactly at that point. And this covers at least the first 2 bullet points (I'm doing that in prod since years). For the last 2 bullet points, it depends whether such things can be achieved with the Schema API (if the Schema cannot represent them, no extension points allowing to change the Schema before comparing it will ever support them)

@nicolas-grekas
Copy link
Member

This is the last issue in the v2.14 milestone, should we move it to v2.15? Or maybe just do nothing and close after @stof's comment?

@derrabus derrabus removed this from the 2.14.0 milestone Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants