Answer the question
In order to leave comments, you need to log in
Yii2 how to solve migration error?
Good evening.
I got a project on Yii2, which has a PostgreSQL database. When migrating, I get this error:
*** applying m160419_000425_add_access_rule
> insert into {{%admin_auth_item}} ...Exception 'yii\db\IntegrityException' with message 'SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "admin_auth_item_pkey"
DETAIL: Key (name)=(partner_sale) already exists.
The SQL being executed was: INSERT INTO "admin_auth_item" ("name", "description", "type", "created_at", "updated_at") VALUES ('partner_sale', 'Заявки партнеров', 2, 1548441309, 1548441309)'
in /home/dmitriy/Projects/gt/vendor/yiisoft/yii2/db/Schema.php:664
Answer the question
In order to leave comments, you need to log in
I decided by doing the migration again, after an error I got into the database and renamed the key with the addition of a symbol, because. just when deleting again, the error popped up. Strange, but that's how it is.
it seems that the database already has data with this key, so the insert swears at "duplicate key value"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question