magento / magento/data-migration-tool

Data Migration: core_store table not having prefix applied as part of join

Open
#838 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
339
Forks
195
PR merge metrics
No merged PRs in 30d

Description

Preconditions
  1. Magento 1 version-1.9.4.5 Tables prefixed "mage_". Multiple stores configured
  2. Magento 2 version-2.3.5p2. Tables prefixed "m2_".
Steps to reproduce
  1. Install data migration tool-2.3.5
  2. Add <source_prefix>mage_</source_prefix> and <dest_prefix>m2_</dest_prefix> to config.xml
  3. Migrate settings successfully
  4. Migrate Data
Expected result
  1. Data migration should complete
Actual result
  1. Data migration fails

[2020-08-20 16:39:55][INFO][mode: data][stage: integrity check][step: Data Integrity Step]: started
90% [=========================>--] Remaining Time: < 1 sec
In Mysql.php line 110:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_1945.core_store' doesn't exist, query was: SELECT DISTINCT child.store_id FROM mage_xmlconnect_application AS child
LEFT JOIN core_store AS parent ON child.store_id = parent.store_id WHERE (child.store_id IS NOT NULL) AND (parent.store_id IS NULL)

In Mysql.php line 91:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento_1945.core_store' doesn't exist

Additional notes

Error appears to be thrown from Migration\Step\DataIntegrity\Model\OrphanRecordsChecker->getOrphanRecordsIds()

Note that in the SQL JOIN statement the 'child' xmlconnect_application table name is prefixed correctly, but the 'parent' part of the JOIN references core_store table and does not contain the DB table prefix. Thus this is not an error caused by an incorrect or missing <source_prefix> node.

It appears that the parentTable property of the OrphanRecordsChecker class is being injected into the constructor with the table prefix not set.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Migration\Step\DataIntegrity\Model\OrphanRecordsChecker->getOrphanRecordsIds() and inspect how its parentTable constructor value is configured. Reproduce the data migration with the source and destination prefixes from the issue, then verify the generated join applies the source prefix to core_store and the migration completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.