Symfony / Doctrine Database Columns Sorting Databases

When I go to generate the table using the doctrine: schema: update command line, it seems that Doctrine (or Symfony?) Wants to drop a command that regroups my columns by placing the keys in the front direction. I was wondering, if I hope that I can turn off this "function" of the environment, so when I go to create my tables, they are stored in the order in which I entered them into the orm.

I was looking for this problem, but it would seem that someone else does not have what I could come up with, and I'm not sure if I need to modify the complete / part of Doctrine or Symfony so that it does not want to rearrange my tables. Any information on which part of the package will contain this logic, or which option I can add to change it, will be very appreciated, because I can not find anything in the documentation yet.

Update: I did some investigation, and I found an overflow question, similar to mine, but not quite. In my case, I am NOT using new data types, and the only columns moved forward are those that I designated as keys (primary or foreign). The teams that he abandons me look VERY similar to this, except that they do this for each of my keys.

ALTER TABLE product_price CHANGE price price DECIMAL(10,2) DEFAULT NULL 

Doctrine custom type always changes table

Update 2: Additional information on request: Starting MySQL in .orm.yml format.

The fields that he wants to set are always key fields, and after I return them to the order that I want / need, he feels the need to reorder the columns every time.

I do not change anything about the fields; he does this both in the initial creations, and whenever I need to start updating the circuit, without any changes in these specific fields.

+3
php mysql symfony doctrine2
source share
2 answers

I did a bit of work, and I don't think you can control this:

https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Schema/Table.php#L555

Judging by this, an order is PK, FK, and other columns in that order. It is difficult to scan the pages of raw logic, so I might have missed something, but from what I can say it does not affect any configuration in order to make an order decision.

+1
source share

I think you should use one of these methods in production

  • Launch application / console doctrine: schema: update --dump-sql and run sql manually
  • Use migration with DoctrineMigrationBundle or something like LiquiBase
+1
source share

All Articles