bitExpert / magento2-force-login

Force Customer Login Module for Magento 2
https://marketplace.magento.com/bitexpert-magento2-force-customer-login.html
Apache License 2.0
166 stars 73 forks source link

Problem with upgrade: 1061 Duplicate key name 'BITEXPERT_FORCELOGIN_WHITELIST_URL_RULE_STORE_ID' #220

Closed VladyslavSikailo closed 11 months ago

VladyslavSikailo commented 2 years ago

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.

manishgoswamig commented 2 years ago

Hi @Dren7755,

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

shochdoerfer commented 2 years ago

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

VladyslavSikailo commented 2 years ago

@manishgoswamig just delete the index before setup:upgrade.

woutk88 commented 2 years ago

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.

zhovnirigor commented 2 years ago

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

shochdoerfer commented 2 years ago

@zhovnirigor thx!

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

shochdoerfer commented 2 years ago

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

juhanihaapala commented 2 years ago

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

shochdoerfer commented 2 years ago

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.