[英]Symfony2 Doctrine indexes using YAML
Because documentation on YAML in Doctrine isn't really informative, I was trying to create indexes for few (already existing) tables from exaple codes. 因为Doctrine中关于YAML的文档并不真正提供信息,所以我试图从exaple代码为少数(已存在的)表创建索引。 I put some additional lines to my *.orm.yml files, but after calling app/console doctrine:generate:entities
and app/console doctrine:schema:update --force
I get a message that my database is already in sync.That's kind of problematic - I'm not an expert in Symfony nor database management at all, but as far as I know indexing your tables is kind of crucial when I use queries a lot, mostly searching by values from one column of a table, ain't I right? 我在我的* .orm.yml文件中添加了一些额外的行,但在调用app/console doctrine:generate:entities
和app/console doctrine:schema:update --force
我收到一条消息,说我的数据库已经同步了。那就是有点问题 - 我根本不是Symfony的专家,也不是数据库管理的专家,但据我所知,当我大量使用查询时,索引表格是至关重要的,主要是通过表格的一列中的值搜索,ain我没错? So please, help me to create indexes via Symfony/Doctrine using YAML, I have no idea what more I can do. 所以,请帮助我使用YAML通过Symfony / Doctrine创建索引,我不知道我还能做些什么。
Here's one of my .orm.yml files: 这是我的.orm.yml文件之一:
Sc0\LoginBundle\Entity\LoginDictionary:
type: entity
table: login_dictionary
indexes:
login_dictionary_index:
columns: [ name ]
id:
name:
type: string
length: 30
fields:
polish:
type: string
length: 150
nullable: false
If it's important I'm using PostgreSQL for database management. 如果重要的是我使用PostgreSQL进行数据库管理。 Maybe I should just create standard indexes using normal postgres queries? 也许我应该使用普通的postgres查询创建标准索引? Will Symfony 'see' those indexes created manually? Symfony会“看到”那些手动创建的索引吗?
Since name
is a primary key there is already an index for this column. 由于name
是主键,因此该列已有索引。 You can check with PHPMyAdmin. 您可以使用PHPMyAdmin查看。 That's why you have the message that the database is already synced: an index is already present. 这就是为什么你有数据库已经同步的消息:索引已经存在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.