Showing posts with label inventory_stock_1. Show all posts
Showing posts with label inventory_stock_1. Show all posts

Friday 27 September 2019

Magento 2 Missing Table when transfer server Error "inventory_stock_1"

Error
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'inventory_stock_1' doesn't exist, query was:........
Solution
1) Open your phpmyadmin
2) Remove your current "inventory_stock_1" if available
3) Run following query on sql
CREATE
SQL SECURITY INVOKER
VIEW `inventory_stock_1`
  AS
    SELECT
    DISTINCT 
      legacy_stock_status.product_id,
      legacy_stock_status.website_id,
      legacy_stock_status.stock_id,
      legacy_stock_status.qty quantity,
      legacy_stock_status.stock_status is_salable,
      product.sku
    FROM `cataloginventory_stock_status` `legacy_stock_status`
      INNER JOIN `catalog_product_entity` product
        ON legacy_stock_status.product_id = product.entity_id;

3) Reindex your store data then check your store.