[英]Symfony2 doctrine:schema:update keeps updating
I've just added a new attribute in my model: 我刚刚在模型中添加了一个新属性:
/**
* @ORM\Column(name="has_donation", type="boolean", options ={"default":false})
*/
private $hasDonation;
And then I tried running: 然后我尝试运行:
php app/console doctrine:schema:update --force
which gave me the following result: 这给了我以下结果:
Updating database schema...
Database schema updated successfully! "1" queries were executed
The problem is that each time I run the schema:update
command, I get the same result - without making any changes to my entities. 问题在于,每次我运行
schema:update
命令时,都会得到相同的结果-无需对实体进行任何更改。 Any idea why? 知道为什么吗? Thanks!
谢谢!
Update Here's the out for php app/console doctrine:schema:update --dump-sql
: 更新这是
php app/console doctrine:schema:update --dump-sql
:
ALTER TABLE Clinic CHANGE has_donation has_donation TINYINT(1) DEFAULT '0' NOT NULL;
I can assume that this issue arises because of usage of illegal or irrelevant mapping information. 我可以假定此问题是由于使用非法或不相关的映射信息而引起的。
In case of the question author, the option "default":false
was illegal. 对于问题作者,选项
"default":false
是非法的。
I had same issue with code: 我对代码有同样的问题:
/**
* @ORM\Column(
* type="boolean",
* nullable=false,
* options={"unsigned":true, "comment":"Is file uploaded manually?"}
* )
*/
protected $manual = false;
In my case the option "unsigned":true
was irrelevant. 在我的情况下,选项
"unsigned":true
是不相关的。 After removing this option, I got the code working. 删除此选项后,我使代码正常工作。
First, try deleting cache. 首先,尝试删除缓存。
Then, try php app/console doctrine:schema:update --dump-sql
to see what updated. 然后,尝试
php app/console doctrine:schema:update --dump-sql
来查看更新的内容。 These options with "default": false
differences are not recorded sometimes. 这些带有
"default": false
选项"default": false
有时不会记录"default": false
差异。 At least on PostgreSQL we use. 至少在PostgreSQL上我们使用。
You might need them to run them manually. 您可能需要它们来手动运行它们。
Tip from our workflow: 我们工作流程中的提示:
1) we setup entities 1)我们设置实体
2) then run php app/console doctrine:schema:update --force
2)然后运行
php app/console doctrine:schema:update --force
3) then run migrations that add there details that are not transformed to database 3)然后运行迁移,在其中添加未转换为数据库的详细信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.