Part 5: EAV Schema Migration — Magento's Biggest Trap

The EAV schema is why most Magento migrations fail. It looks manageable from the outside: products stored across catalog_product_entity, catalog_product_entity_varchar, catalog_product_entity_int, catalog_product_entity_decimal, catalog_product_entity_datetime, and catalog_product_entity_text. Six tables, straightforward ETL job, done in a weekend. Then you discover that attribute_id = 75 means “product name” in your Magento instance and “color” in your staging instance. Every attribute ID is generated at install time and differs between environments. Any ETL script that hardcodes attribute IDs will produce corrupted data in production. ...

May 6, 2026 · 9 min · Lê Tuấn Anh

Exporting Magento 2 Data: Flatten EAV with SQL & Node

Answer-first: Extracting Magento 2 EAV data efficiently requires direct SQL joins that flatten entity tables, avoiding expensive ORM overhead. By piping the database cursor into Node.js transform streams, we handle backpressure natively, exporting millions of product records with a memory footprint under 100MB. What You’ll Learn That AI Won’t Tell You How to optimize complex EAV joins in MySQL using index hints to prevent full table scans on catalogs exceeding 1 million SKUs. Complete Node.js stream backpressure implementations that keep memory usage under 100MB while processing millions of records. When migrating off Magento 2, the first obstacle is always the database schema. Magento does not store data in clean flat rows — it uses an Entity-Attribute-Value (EAV) model that spreads data across dozens of tables with store-scope inheritance. Understanding this before writing SQL will save you days. ...

March 9, 2024 · 8 min · Lê Tuấn Anh