6

After a fresh install of the latest beta Magento release, I have an error when running integration tests that seems to be related to stock feature. Since the stock has been under heavy development in this release, I was wondering if anybody knows how to resolve this one?

After fresh install of Magento 2.3 with sample data, the integration test command php ../../../vendor/bin/phpunit returns an error, see below:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento23_test.inventory_stock_1' doesn't exist, query was: SELECT `e`.*, `selection`.*, `stock_status_index`.`is_salable` FROM `catalog_product_entity` AS `e`

3 Answers 3

9

The CREATE ALGORITHM statement requires elevated MySQL access. It is likely that the server you are working on does not have this and will halt the import process.

This line needs to come out of the SQL being migrated.

Instead run the following to create the view

CREATE
OR REPLACE
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` )));
0
3

its because inventory_stock_1 view is dropped execute this query on your database for magento 2.3

dont forget to replace replace PUT_YOUR_DATABASE_USER_NAME_HERE

--
-- Structure for view `inventory_stock_1`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`PUT_YOUR_DATABASE_USER_NAME_HERE`@`localhost` 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`)) ;

--
-- VIEW  `inventory_stock_1`
-- Data: None
--
1
  • 1
    I know I got this resolved at the time but I admit I lost track with what was the issue. Apologies I can’t recall whether your solution would resolve the problem Commented Jan 15, 2019 at 21:16
0

Please execute this SQL query to resolve your issue

CREATE
OR REPLACE
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` )));
1
  • No this is not working for me Commented Jan 7, 2022 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.