有一个字段:
#[ORM\Column(length: 255, nullable: true, )]
private ?string $inn = null;
如何通过迁移添加单列索引以避免 Symfony 中的错误。
我尝试在官方学说网站上查找有关此内容的文档,但只找到有关实体之间关系索引的信息。
在类的顶部,添加类似这样的内容
#[ORM\Index(columns: ['inn'], name: 'application_inn_idx')]
然后生成迁移
symfony console make:migration
然后运行迁移
symfony console doctrine:migration:migrate