magento2-force-login
magento2-force-login copied to clipboard
Problem with upgrade: 1061 Duplicate key name 'BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID'
Preconditions
- Magento 2.4.3-p1
- "bitexpert/magento2-force-customer-login": "^v4.1"
Steps to reproduce
- Upgrade Magento to 2.4.4
- Upgrade "bitexpert/magento2-force-customer-login": "^5.0.1"
Expected result
- bin/magento setup:upgrade will be finished successfully
Actual result
- 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.
Hi @Dren7755,
Have you got the solution for this issue because I am facing the same issue with 2.4.4 EE setup.
Any chance you could delete the index first before running the upgrade?
@manishgoswamig just delete the index before setup:upgrade.
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.
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 thx!
Sorry people for letting you hang, life came in my way. Will probably have some time to fix this next month.
@zhovnirigor if you are up for it, open a PR. Very much appreciated.
I added the fix with patch and confirmed it will fix the issue.
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.