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

[BUGFIX] Filter the columns to import from the old premium database table before inserting in the new table within MigratePremiumFocusKeywords #556

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

RinyVT
Copy link
Collaborator

@RinyVT RinyVT commented Sep 12, 2023

Summary

This PR can be summarized in the following changelog entry:

  • The migration of the premium keywords could not only fail on cruser_id, but also when the premium table had other fields which were not present in the new table. This PR filters the array to insert by only allowing columns which are present in the new table.

Relevant technical choices:

  • Retrieve the columns from the SchemaManager and return it as a flipped array from the keys only, to use the array_intersect_key on every insert

Test instructions

This PR can be tested by following these steps:

  • Pull branch
  • Manually add a column to the old tx_yoast_seo_premium_focus_keywords table (and make sure it contains records)
  • Run the upgrade wizard and check for errors and if the data has been successfully migrated

Quality assurance

  • I have tested this code to the best of my abilities
  • I have added unittests to verify the code works as intended

…able before inserting in the new table within MigratePremiumFocusKeywords
@RinyVT RinyVT merged commit 99182a0 into main Sep 18, 2023
9 checks passed
@RinyVT RinyVT deleted the bugfix/premium-migration-fix branch September 18, 2023 09:45
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.

1 participant