禁用 yml 中相关对象 ID 的自动索引
Doctrine 自动在用于定义对象关系的列上创建索引,
例如
user: id, name
message: id, sender_id,receiver_id, message
如果我以消息有一个发送者和一个接收者的方式定义消息和用户之间的关系,当我从模型生成sql时,学说将自动索引sender_id和receiver_id字段。我想禁用发送者上的索引,因为我使用发送者 ID 和接收者 ID 一起手动创建索引。如何禁用自动生成的索引?
Doctrine Automatically creates indexes on columns that are used to define object relations,
For example
user: id, name
message: id, sender_id, receiver_id, message
if I define relationship between message and user in a way that message has one Sender and has one Receiver, doctrine will automatically index sender_id and receiver_id fields when I generate sql from model. I would like to disable index on sender, because I manually create index with sender_id and receiver id together. How can I disable auto generated index?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你好,我假设你使用的是 MySQL,并查看了 Doctrine/Export/Mysql.php
我发现:
如果我理解正确,禁用索引应该是主键的一部分。
Hello I assumed you were using MySQL, and took a look in Doctrine/Export/Mysql.php
I found this :
If I understand correctly, to disable the index should be part of the primary key.