symfony - Duplicate index on sqlite, not on mysql -
i have entity definition works on dev , production envs (mysql), 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 run doctrine:schema:create or doctrine:schema:update --force on test env, have following error:
[doctrine\dbal\dbalexception] exception occurred while executing 'create index created_at_idx on invoice (created_at)': sqlstate[hy000]: general error: 1 index created_at_idx exists [pdoexception] sqlstate[hy000]: general error: 1 index created_at_idx exists
is had kind of issue? how solve/ignore it?
thanks.
solution here: https://stackoverflow.com/a/24634713/1731473
in nutshell, index should have unique name across database.
so can't have:
invoice -> created_at_idx user -> created_at_idx
but:
invoive -> invoice_created_at_idx user -> user_created_at_idx
Comments
Post a Comment