简体   繁体   English

如何在Symfony2中更新mysql数据库架构

[英]How can I update mysql database schema in Symfony2

Can anybody help me? 有谁能够帮助我? How can i update mysql database schema (entity, doctrine yml etc) after inserting new integer field type? 插入新的整数字段类型后,如何更新mysql数据库架构(实体,教义yml等)?

I added manually a new field into mysql, I get semantical error like this : 我手动将一个新字段添加到mysql中,出现如下语义错误:

       Site\SiteBundle\Entity\Yorum has no field or association named yayin

using cmd or a console go to the root of the project and type 使用cmd或控制台转到项目的根目录并键入

php app/console doctrine:schema:update --force PHP应用程序/控制台学说:模式:更新-力

and remember to clear up your cache 并记得清除缓存

NOTE: You shouldn't do the changes directly into mysql, add the field into the entity and remember to put the right annotations with the field type, length, etc, when you do the schema:update, that would update the sql schema and you'd probably avoid getting this kind of error messages 注意:您不应该直接在mysql中进行更改,不要将字段添加到实体中,并且记住在执行schema:update时要使用字段类型,长度等添加正确的注释,这将更新sql schema和您可能会避免收到此类错误消息

Check the docs for more info on this subject 检查文档以获取有关此主题的更多信息

Do you have any relations between two tables? 两个表之间有关系吗?

Because the error 因为错误

  Site\SiteBundle\Entity\Yorum has no field or association named yayin

This error is thrown when there is relation between tables 表之间存在关系时抛出此错误

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM