我发现了类似的问题,但它们在应用程序中,我的与 cli 命令有关,即php app/console doctrine:schema:update --force
或php app/console doctrine:migrations:migrate
错误:
Migration 20130112151503 failed during Execution. Error An exception occurred wh
ile executing 'CREATE UNIQUE INDEX UNIQ_68D3801E989D9B62 ON artists (slug)':
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key
'UNIQ_68D3801E989D9B62'
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'CREATE UNIQUE INDEX UNIQ_68D3801E989
D9B62 ON artists (slug)':
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' fo
r key 'UNIQ_68D3801E989D9B62'
我真的希望迁移能够解决这个错误,但是唉。我该如何解决这个问题,例如我只能在实时服务器上运行迁移命令。如果存在,迁移为什么不首先删除唯一索引?或者为什么它没有检测到已经有一个唯一索引?