mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Schema update does not add column to the right place nor reorder them #6533
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mvorisek on GitHub (Sep 2, 2020).
Step to reproduce:
AFTER(see https://dev.mysql.com/doc/refman/5.7/en/alter-table.html#alter-table-redefine-column) in the update command (in step 4)I belive this needs to be addressed in the
Doctrine\DBAL\Schema\Comparatoras it is used for diffing the schema in:ccae8f7176/lib/Doctrine/ORM/Tools/SchemaTool.php (L906)@mvorisek commented on GitHub (Sep 2, 2020):
related with https://github.com/doctrine/dbal/issues/1411
@SenseException commented on GitHub (Sep 2, 2020):
If such a feature will be developed, I wouldn't determine the positions of columns on the order of an entity's properties. The structure of the class itself shouldn't affect the resulting query at all. An optional attribute in the
Columnannotation would be one way for a new configuration. I don't know about a use case that would justify implementing and maintaining this feature for all supported databases (yet).@mvorisek commented on GitHub (Sep 2, 2020):
order of an entity's properties should define implicit order, it is the case now, only when DB is updated, the order may end up to be different as shown in the example
@SenseException commented on GitHub (Sep 3, 2020):
Which is why an explicit order shouldn't be determined by the properties. The implicit order is not a feature but just the way it was implemented. If a project is using coding styles, that expect changes in the order of properties (e.g. order by scopes), it shouldn't result in an Alter-statement for the database.
@beberlei commented on GitHub (Sep 13, 2020):
This is a cosmetic thing that you can add yourself if you want to, but its not something that we are going to add to Doctrine DBAL Schema support.