Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add db_schema_whitelist to prevent Multiple primary key defined error on nosto_tagging_customer #841

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

piotrkwiecinski
Copy link
Contributor

Description

Fixes:

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'

Related Issue

#840

Motivation and Context

Magento modules must include db_schema_whitelist.json to perform certain operations like column rename, drop, recreate keys on tables.

https://developer.adobe.com/commerce/php/development/components/declarative-schema/configuration/#perform-common-database-operations

How Has This Been Tested?

  • Have a magento instance with old version (5.2.1 in my case) of module installed in db.
  • Update module code to the latest version
  • Run bin/magento s:up

Documentation:

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • I have assigned the correct milestone or created one if non-existent.
  • I have correctly labeled this pull request.
  • I have linked the corresponding issue in this description.
  • I have updated the corresponding Jira ticket.
  • I have requested a review from at least 2 reviewers
  • I have checked the base branch of this pull request
  • I have checked my code for any possible security vulnerabilities

@supercid supercid merged commit 04eb89f into Nosto:develop Jan 16, 2024
@supercid
Copy link
Member

Hi @piotrkwiecinski thanks for this! I'll include it soon in our next release.

@piotrkwiecinski piotrkwiecinski deleted the db-schema-whitelist branch January 16, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants