magento2-force-login icon indicating copy to clipboard operation
magento2-force-login copied to clipboard

Problem with upgrade: 1061 Duplicate key name 'BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID'

Open VladyslavSikailo opened this issue 2 years ago • 9 comments

Preconditions

  1. Magento 2.4.3-p1
  2. "bitexpert/magento2-force-customer-login": "^v4.1"

Steps to reproduce

  1. Upgrade Magento to 2.4.4
  2. Upgrade "bitexpert/magento2-force-customer-login": "^5.0.1"

Expected result

  1. bin/magento setup:upgrade will be finished successfully

Actual result

  1. bin/magento setup:upgrade fails with the following error:
Updating modules:
Cache cleared successfully
Schema creation/updates:
SQLSTATE[42000]: Syntax error or access violation: 1061 Duplicate key name 'BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID', query was: ALTER TABLE `bitexpert_forcelogin_whitelist` MODIFY COLUMN `strategy` text NULL COMMENT "strategy matcher identifier", ADD INDEX `BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID` (`url_rule`,`store_id`)

Why it happened

It happened because my bitexpert_forcelogin_whitelist table has index create index BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID on bitexpert_forcelogin_whitelist (url_rule);

When I upgrade - it tries to create index with the same name but with additional column.

VladyslavSikailo avatar Jun 16 '22 13:06 VladyslavSikailo

Hi @Dren7755,

Have you got the solution for this issue because I am facing the same issue with 2.4.4 EE setup.

manishgoswamig avatar Jul 13 '22 12:07 manishgoswamig

Any chance you could delete the index first before running the upgrade?

shochdoerfer avatar Jul 13 '22 18:07 shochdoerfer

@manishgoswamig just delete the index before setup:upgrade.

VladyslavSikailo avatar Jul 13 '22 19:07 VladyslavSikailo

Any updates on this? I am experiencing the same issue.

For now I've installed version 5.0.0 (instead of latest 5.0.1) which doesn't seem to have the issue.

woutk88 avatar Aug 11 '22 08:08 woutk88

Whoever faced this issue just run bin/magento setup:db-declaration:generate-whitelist --module-name=BitExpert_ForceCustomerLogin. @shochdoerfer just add etc/db_schema_whitelist.json to the package

zhovnirigor avatar Aug 22 '22 15:08 zhovnirigor

@zhovnirigor thx!

Sorry people for letting you hang, life came in my way. Will probably have some time to fix this next month.

shochdoerfer avatar Aug 22 '22 18:08 shochdoerfer

@zhovnirigor if you are up for it, open a PR. Very much appreciated.

shochdoerfer avatar Aug 22 '22 18:08 shochdoerfer

I added the fix with patch and confirmed it will fix the issue.

juhanihaapala avatar Oct 13 '22 09:10 juhanihaapala

dev-master branch is updated. Will see that I prepare a new release soonish. Sorry for the long waiting time but way too much other stuff on my plate.

shochdoerfer avatar Oct 15 '22 13:10 shochdoerfer