在具有 Doctrine ORM 的 Symfony 中,如何将自动增量列默认为整数而不是 bigint?
似乎在带有 Doctrine 的 Symfony 1.4 中,当生成自动增量列(id)时,它默认为 bigint。这看起来完全是多余的,我只想将其默认为整数。
下面生成一个名为 id 的主键列,它是一个 bigint
JobeetCategory:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
是否有配置文件可以更改它。我不想手动将 id 列添加为整数。
It seems that in Symfony 1.4 with Doctrine that when generating auto-increment columns (id) it defaults to bigint. This seems like total overkill and I would just like to default it to an integer instead.
The following produces a primary key column named id that is a bigint
JobeetCategory:
actAs: { Timestampable: ~ }
columns:
name: { type: string(255), notnull: true, unique: true }
Is there a configuration file I can change this in. I don't want to have to manually add the id column as an integer.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,不。
如果您最终手动将 id 列添加到架构中,您可以将它们的类型指定为整数(4) 来创建 MySQL
int
字段:http://www.symfony-project.org/doctrine/1_2/en/ 04-架构文件#chapter_04_data_types。Not that I'm aware of, no.
If you do end up manually adding the id columns into your schema you can specify their type as
integer(4)
to create a MySQLint
field: http://www.symfony-project.org/doctrine/1_2/en/04-Schema-Files#chapter_04_data_types.