Nosto / nosto-magento2

https://marketplace.magento.com/nosto-module-nostotagging.html
Open Software License 3.0
27 stars 26 forks source link

Multiple primary key defined nosto_tagging_customer while updating from old module version #840

Closed piotrkwiecinski closed 8 months ago

piotrkwiecinski commented 9 months ago

Magento 2 version(s) used: 2.4.6 Extension version(s) affected: 7.3.1

Description
Setup update error while updating older notso module:

SQLSTATE[42000]: Syntax error or access violation: 1068 Multiple primary key defined, query was: ALTER TABLE `nosto_tagging_customer` MODIFY COLUMN `customer_id` int UNSIGNED NULL   COMMENT "Customer ID", MODIFY COLUMN `quote_id` int UNSIGNED NOT NULL   , MODIFY COLUMN `nosto_id` varchar(255) NOT NULL  COMMENT "Nosto Customer ID", MODIFY COLUMN `restore_cart_hash` text NULL COMMENT "Restore Cart Hash", ADD COLUMN `id` int UNSIGNED NOT NULL  AUTO_INCREMENT COMMENT "ID", AUTO_INCREMENT = 375690, ADD CONSTRAINT  PRIMARY KEY (`id`), ADD INDEX `NOSTO_TAGGING_CUSTOMER_QUOTE_ID` (`quote_id`), COMMENT='Nosto Tagging Customer', DEFAULT CHARSET='utf8', DEFAULT COLLATE='utf8_general_ci'

How to reproduce

Magento 2 mode

Full page cache

Nosto indexer mode

Possible Solution
Generate db_schema_whitelist for the module: bin/magento setup:db-declaration:generate-whitelist --module-name Nosto_Tagging The generated file should be included in this repo.