如何使用BIGINT类型生成sql? [英] How to get doctrine to generate sql with BIGINT type?
问题描述
在我的架构中,我有一些字段需要是BIGINT。我使用symfony的
In my schema I have a number of field that need to be BIGINT. I use symfony's
symfony doctrine:build-sql
生成我的数据库。
这些字段总是作为int类型出现。
The fields always come out as type int.
我在模式中尝试过以下类型:
I have tried the following types in the schema:
int
{type: integer, notnull: true}
{type: integer(5), notnull: true}
{type: bigint, notnull: true}
它们似乎都没有工作(在构建SQL之前我总是重建模型)
None of them seem to work (I always rebuild the model before building the SQL).
我应该在schema.yml中输入什么类型?
What type should i put in the schema.yml?
推荐答案
使用 @ ORM\Column(name =id,type =bigint),使用Symfony 2.x(例如Doctrine 2.4.1)和PHP注释实体,
导致MySQL bigint(20)
。
With Symfony 2.x (e.g. Doctrine 2.4.1) and PHP annotations on Entities, using @ORM\Column(name="id", type="bigint")
results in a MySQL bigint(20)
.
注意:OP使用symfony1& doctrine1,该解决方案将不起作用。
NB: OP tagged this question with symfony1 & doctrine1, for which this solution will not work.
这篇关于如何使用BIGINT类型生成sql?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!