数据库表中的Symfony2字段顺序

时间:2021-12-17 07:34:54

I have generated 2 entities in my bundle and then using app/console doctrine:schema:update --force I recreate database schema. The order of fields that I have defined in the entities does not match the order of fields in the database table. Is there a way to control/define order in which fields are listed in the database table?

我在我的包中生成了2个实体,然后使用app / console doctrine:schema:update --force我重新创建了数据库模式。我在实体中定义的字段顺序与数据库表中字段的顺序不匹配。有没有办法控制/定义数据库表中列出的字段的顺序?

Thanks, Z

1 个解决方案

#1


0  

It's not a problem; If you have generated the schema first then you updated it, the new fields will be just appended to current columns.

这不是一个问题;如果您先生成了架构,然后更新了它,则新字段将仅附加到当前列。

Furthermore you can find this different order for columns which has relationship which will be appended, too (on the generation time). In fact it does not create any issue; but if it's important to you, you can change the arrangement through one of the DataBase Management Tools (e.g. phpMyAdmin)

此外,您可以找到具有关系的列的不同顺序(也将在生成时间上)。事实上它并没有造成任何问题;但如果它对您很重要,您可以通过其中一个DataBase管理工具(例如phpMyAdmin)更改安排

#1


0  

It's not a problem; If you have generated the schema first then you updated it, the new fields will be just appended to current columns.

这不是一个问题;如果您先生成了架构,然后更新了它,则新字段将仅附加到当前列。

Furthermore you can find this different order for columns which has relationship which will be appended, too (on the generation time). In fact it does not create any issue; but if it's important to you, you can change the arrangement through one of the DataBase Management Tools (e.g. phpMyAdmin)

此外,您可以找到具有关系的列的不同顺序(也将在生成时间上)。事实上它并没有造成任何问题;但如果它对您很重要,您可以通过其中一个DataBase管理工具(例如phpMyAdmin)更改安排