I have a entity definition that works on dev and production envs (mysql), but not on test (sqlite):
/**
* Invoice
*
* @ORM\Table(name="invoice", indexes={
* @ORM\Index(name="ref_idx", columns={"ref"}),
* @ORM\Index(name="created_at_idx", columns={"created_at"}),
* @ORM\Index(name="paid_idx", columns={"paid"}),
* @ORM\Index(name="is_valid_idx", columns={"is_valid"}),
* @ORM\Index(name="canceled_idx", columns={"canceled"})
* })
* @ORM\Entity(repositoryClass="AppBundle\Repository\InvoiceRepository")
*/
class Invoice
// [...]
When I run doctrine:schema:create or doctrine:schema:update --force on test env, I have the following error:
[Doctrine\DBAL\DBALException]
An exception occurred while executing 'CREATE INDEX created_at_idx ON invoice (created_at)':
SQLSTATE[HY000]: General error: 1 index created_at_idx already exists
[PDOException]
SQLSTATE[HY000]: General error: 1 index created_at_idx already exists
Is someone already had this kind of issue? How to solve/ignore it?
Thanks.
The solution is here: https://stackoverflow.com/a/24634713/1731473
In a nutshell, your index must have a unique name across your database.
So you can't have:
But:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With