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

Column order doesn't match order of properties in the entity class in "diff" command #558

Closed
aik099 opened this issue Oct 17, 2017 · 3 comments

Comments

@aik099
Copy link

aik099 commented Oct 17, 2017

I have an entity, where each property has @ORM\Column(...) annotation. When diff command is executed the first time, then columns in created table are ordered exactly as properties in the entity class.

When I add property between 2 other properties, then next diff run is adding column at the end of the table and not according to property position in the entity class.

Is this (not to preserve order of columns in table) expected behavior or a bug?

P.S.
I know that placing columns in specific position in the table is likely to work for MySQL only.

@aik099 aik099 changed the title Column order doesn't match order of properties in the entity class Column order doesn't match order of properties in the entity class on "diff" command Oct 17, 2017
@aik099 aik099 changed the title Column order doesn't match order of properties in the entity class on "diff" command Column order doesn't match order of properties in the entity class in "diff" command Oct 17, 2017
@aik099
Copy link
Author

aik099 commented Oct 18, 2017

Even in CREATE TABLE statement entity class properties with @ORM\ManyToOne annotation (or any relation annotation) instead of @ORM\Column annotation are added at the end of the table.

@mikeSimonson
Copy link
Contributor

mikeSimonson commented Oct 25, 2017

As far as I know, it was never a goal to keep the order the same.
From the point of view of the ORM the class is still the same if the properties order change.

Also this issue is related to the schema diff generation which is done by the dbal not by doctrine migrations.

@aik099
Copy link
Author

aik099 commented Oct 25, 2017

As far as I know, it was never a goal to keep the order the same.
From the point of view of the ORM the class is still the same if the properties order change.

Makes sense, thank you.

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

2 participants