magento / magento/data-migration-tool

SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint eav_entity_type` (`entity_type_id)

Open
#921 1 comment 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. Migrating from Magento 1.9.4.3 to Magento 2.4.6
Steps to reproduce
  1. php bin/magento migrate:data --reset --auto vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.4.3/config.xml
Expected result
  1. No errors
Actual result

data migration][step: EAV Step]: started
0% [>---------------------------] Remaining Time: < 1 sec
In Mysql.php line 109:

SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a t
able referenced in a foreign key constraint (zskffssgtt.eav_attribute,
CONSTRAINT EAV_ATTRIBUTE_ENTITY_TYPE_ID_EAV_ENTITY_TYPE_ENTITY_TYPE_ID FO
REIGN KEY (entity_type_id) REFERENCES zskffssgtt.eav_entity_type (en tity_type_id), query was: TRUNCATE TABLE eav_entity_type`

In Mysql.php line 90:

SQLSTATE[42000]: Syntax error or access violation: 1701 Cannot truncate a t
able referenced in a foreign key constraint (zskffssgtt.eav_attribute,
CONSTRAINT EAV_ATTRIBUTE_ENTITY_TYPE_ID_EAV_ENTITY_TYPE_ENTITY_TYPE_ID FO
REIGN KEY (entity_type_id) REFERENCES zskffssgtt.eav_entity_type (`en
tity_type_id)

Additional notes

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 by reproducing the migration with php bin/magento migrate:data --reset --auto and inspect the EAV Step failure reported at Mysql.php lines 90 and 109. Trace how the migration handles TRUNCATE TABLE eav_entity_type while eav_attribute references it. Done means the migration completes without the reported foreign-key error.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.