data-migration-tool
data-migration-tool copied to clipboard
Catalog Search index process unknown error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.store_id' in 'field list', query was: SELECT `u`.* FROM ( (SELECT `t`.`value`, `t`.`attribute_id`, `t`.`store_id` FROM `customer_entity_varchar` AS `t`....
Preconditions
- Migrating from Magento 1.9.4.5
- Migrating to Magento 2.4.0
Steps to reproduce
- Setup clean installation of Magento 2.4.0
- Run Settings migration as usual
- Run Data migration as usual
- Perform reindexing
Expected result
- Successfully rebuilt Catalog Search index.
Actual result
Catalog Search index process unknown error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 't.store_id' in 'field list', query was: SELECT
u.* FROM ( (SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
customer_entity_varcharAS
t WHERE (entity_id = '3') AND (attribute_id IN ('111', '479', '113', '114', '118', '563', '533', '514', '927', '982')) AND (
store_idIN ('2', 0)))UNION ALL(SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
customer_entity_intAS
t WHERE (entity_id = '3') AND (attribute_id IN ('119', '940', '941', '937', '117', '120')) AND (
store_idIN ('2', 0)))UNION ALL(SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
customer_entity_textAS
t WHERE (entity_id = '3') AND (attribute_id IN ('112', '115', '116', '121', '122', '123', '926', '530')) AND (
store_idIN ('2', 0)))UNION ALL(SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
catalog_category_entity_varcharAS
t WHERE (entity_id = '3') AND (attribute_id IN ('965')) AND (
store_idIN ('2', 0)))UNION ALL(SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
customer_entity_datetimeAS
t WHERE (entity_id = '3') AND (attribute_id IN ('565', '566')) AND (
store_idIN ('2', 0)))UNION ALL(SELECT
t.
value,
t.
attribute_id,
t.
store_idFROM
customer_entity_decimalAS
t WHERE (entity_id = '3') AND (attribute_id IN ('942')) AND (
store_idIN ('2', 0))) ) AS
uORDER BY
store_id ASC
Additional notes
I managed to migrate both Settings and data successfully to a freshly installed magento 2.4.0 project.
My orders, products, settings etc .. where successfully migrated ( i am able to see them in backend )
But when i run the command php bin/magento indexer:reindex
after successful migration, it shows this sql error.
This same sql error is shown when i take the category menu in backend admin panel.
I checked in my old magento 1.9.4.5 site, there also store_id
column is not present in customer_entity_varchar
table, but everything is working perfectly there.
Tried migrating data again in a freshly installed magento 2.4.0 agian, but no luck.
Hi @iamprasanthmp. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.
Please, add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
Hi @iamprasanthmp! :wave:
Thank you for collaboration. Only members of Community Contributors Team are allowed to be assigned to the issue. Please use @magento add to contributors team
command to join Contributors team.
Hi @iamprasanthmp! :wave: Thank you for joining. Please accept team invitation :point_right: here :point_left: and add your comment one more time.
@iamprasanthmp Hi, i'm having the same problem.. so far from what i can tell, something in magento is trying to use customer address tables for the category information.
i got the admin working by doing this:
alter table customer_address_entity_decimal add `store_id` smallint(5) NOT NULL DEFAULT 0 COMMENT 'Store Id';
alter table customer_address_entity_datetime add `store_id` smallint(5) NOT NULL DEFAULT 0 COMMENT 'Store Id';
alter table customer_address_entity_text add `store_id` smallint(5) NOT NULL DEFAULT 0 COMMENT 'Store Id';
alter table customer_address_entity_int add `store_id` smallint(5) NOT NULL DEFAULT 0 COMMENT 'Store Id';
alter table customer_address_entity_varchar add `store_id` smallint(5) NOT NULL DEFAULT 0 COMMENT 'Store Id';
by adding the missing store_id field to those tables, indexing will work, and you should be able to gain access to the CATALOG -> CATEGORIES page, but you'll see that none of the categories have any text.. just their id's, and number of products in parentheses.
i started messing around by adding a catagory name and grepping to see where it changed, and if your actually able to save without it erroring.. you'll notice that it's populating the customer_address_entity_varchar
table.
i'm pretty sure it's supposed to be using catalog_category_entity_varchar
so somewhere it got messed up during migration.
so in my case, i have a lot of sites i've been converting, and the ones that were true 1.9.0.1 convert no problem, but sites that used to be 1.3.2.4 and got migrated over to 1.9.0.1 then migrated again to 2.4.0 are the ones that are failing for me.
Hello @thedarkboo, The issue still exist when trying to migrate straight from 1.9.4.5 to 2.4.0. The work around i figure out was to migrate to 2.3.4 and from there upgrading to 2.4.0. Hope it solves the issue for you to.
Hello, i just wanted to follow up.
When i did a select * from catalog_category_entity
the attribute_set_id was set to 5 for all my entity_ids other than 1 (which was set to 0) so i did update catalog_category_entity set attribute_set_id = 3 where attribute_set_id = 5;
and reindexed and flushed, and everything seems to be working now.
i might be wrong, but i think this might have to do with the way things were inserted in the original db. The order of all the inserts seem to be odd numbers.. so the sequence of ids are inserted by odds like.. 1, 3, 5, 7, 9.
i noticed that in my later 1.9 db's (that work without any problems), they inserts are ordered sequentially 1, 2, 3, 4, 5...
@thedarkboo @iamprasanthmp you don't need update customer tables!
UPDATE eav_entity_attribute
SET entity_type_id = {entity_type_id_you_need}
WHERE entity_attribute_id IN (SELECT entity_attribute_id FROM (
SELECT eea.*
FROM `eav_entity_attribute` AS eea
JOIN `eav_attribute` AS ea ON eea.`attribute_id` = ea.`attribute_id`
WHERE ea.`entity_type_id` = {entity_type_id_you_need}
) as x);
{entity_type_id_you_need} you can check in eav_entity_type
(entity_type_code = 'catalog_category')
@romastepa In the end, none of these solutions worked for me.. because when you set the entity_type_id to something else, it causes problems elsewhere. So in the end, i wrote a script to go through and reindex the db tables to be sequential and it seems to be working fine now.
The issue i had after setting the entity_type_id to 5 was the customer addresses where not showing up in the orders or their overview page.. related to: https://github.com/magento/magento2/issues/5873