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

Doctrine migrations does not aknowlege changes in entities #688

Closed
liorchamla opened this issue Nov 21, 2019 · 4 comments
Closed

Doctrine migrations does not aknowlege changes in entities #688

liorchamla opened this issue Nov 21, 2019 · 4 comments

Comments

@liorchamla
Copy link

liorchamla commented Nov 21, 2019

It seems that since this PR (bf7c5fd ) the make:migration command is "bugged".

It does not take into accounts changes made to entities and just generate the minimum SQL to create the tables and add an id.

By now, we have to run doctrine:cache:clear-metadata each time we change an entity if we want make:migration to take changes into account.

To be honest I absolutely don't know what happened and how I can fix it, so please apologize for not being able to create a PR.

Easy to reproduce : create a new Symfony app using composer create-project symfony/website-skeleton demo then create a first entity and run make:migration then look at the migration file. You will see that it only creates the table. If you want it to take into account all fields metadata, you will had to run doctrine:cache:clear-metadata and then make:migration will be fine :)

@dsentker
Copy link

I have the same problem. This seems like a bug, a very annoying one. Any ideas for this?

@dmaicher
Copy link
Contributor

Yes this is currently an issue with wrongly configured caches on DoctrineBundle. We are working on a fix.

See doctrine/DoctrineBundle#1073

@mathieu-coingt
Copy link

In the same way, there is a problem when you create a OneToOne relation with cascade persist : it doesn't persist the associated entity. You have to run doctrine:cache:clear-metadata as said by @liorchamla above.

@dmaicher
Copy link
Contributor

There are new patch releases on DoctrineBundle to address this issue.

Please also make sure to sync the latest recipe changes seen here to ensure proper caching in prod: https://github.com/symfony/recipes/pull/695/files

@xabbuh xabbuh closed this as completed Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants