While running
1 |
php bin/magento indexer:reindex |
Above command getting below exception.
1 |
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory_stock_1' doesn't exist, query was: INSERT INTO'search_tmp_5c4f24124efa61_76233970'SELECT'main_select'.'entity_id', SUM(score) AS'relevance'FROM (SELECT DISTINCT'search_index'.'entity_id', (((0) + (0)) * 1) AS'score'FROM'catalog_product_index_eav'AS'search_index' INNER JOIN 'catalog_product_entity' AS 'product' ON product.entity_id = search_index.entity_id INNER JOIN 'inventory_stock_1' AS 'stock_index' ON stock_index.sku = product.sku INNER JOIN 'catalog_category_product_index_store1' AS 'category_ids_index' ON search_index.entity_id = category_ids_index.product_id AND category_ids_index.store_id = '1' WHERE (search_index.store_id = '1') AND ('search_index'.'attribute_id' = 102 AND 'search_index'.'value' in ('2', '4') AND 'search_index'.'store_id' = '1') AND (category_ids_index.category_id = 394)) AS 'main_select' GROUP BY 'entity_id' ORDER BY 'relevance' DESC, 'entity_id' DESC LIMIT 10000 Exception #1 (PDOException): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory_stock_1' doesn't exist |
To overcome the programmatical error, you need to create a view of the inventory_stock_1 table – We did some changes in the database.
Here is the command we ran in DB SQL.
1 |
CREATE ALGORITHM=UNDEFINED DEFINER=CURRENT_USER SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`))) |
There you go. Now things will run smoothly. Hope it will work for everyone.
If you want restrict customer to checkout based on your...
Sometime we need to set html data without load or...
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-628773de80995113868370/] Create...
You can try below code to change local date to...