magento / merchdocs

Magento User Guide

Home Page:http://docs.magento.com/user-guide/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extension fails to install if the database has a PREFIX

adrianbsystems opened this issue · comments

Steps to replicate:
composer require magento/module-amazon
composer require magento/services-connector
php bin/magento setup:upgrade

Expected result: setup completes normally
Actual Result:
Unable to apply patch Magento\Amazon\Setup\Patch\Schema\DropUnnecessaryIndexesLeftFromOldSchema for module Magento_Amazon. Original exception message: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento2.channel_amazon_account' doesn't exist, query was: SHOW INDEX FROM channel_amazon_account

If the database does not have a PREFIX, the extension installs normally.

Environment:
Fresh install Magento CE 2.4.4
No other third party extensions, default Luma theme
Debian 11 Bullseye, Kernel: Linux 5.10.0-16-amd64
PHP8.1, Nginx 1.23, MariaDB 10.7, ElasticSearch 7.16, Composer 2.1.4

Hi @adrianbsystems. Thank you for your report.
To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


If the database PREFIX is manually added the the files below, setup completes successfully, But this seems not the correct procedure ?

/vendor/magento/module-amazon/Setup/Patch/Schema/DropUnnecessaryIndexesLeftFromOldSchema.php

/**
* @var ModuleDataSetupInterface $moduleDataSetup
*/
private $moduleDataSetup;

private $indexesToDelete = [
    'nY3g_channel_amazon_account' => [
        'CHANNEL_AMAZON_ACCOUNT_UNIQUEVALUE' => 'unique',
        'MERCHANT_ID_MERCHANT_ID' => 'index',
    ],
    'nY3g_channel_amazon_account_listing' => [
        'CHANNEL_AMAZON_ACCOUNT_LISTING_UNIQUEVALUE' => 'unique',
        'MERCHNAT_ID_MERCHANT_ID' => 'index',
    ],
    'nY3g_channel_amazon_account_order' => [
        'CHANNEL_AMAZON_ACCOUNT_ORDER_UNIQUEVALUE' => 'unique',
        'MERCHNAT_ID_MERCHANT_ID' => 'index',
    ],
    'nY3g_channel_amazon_action' => [
        'CHANNEL_AMAZON_ACTION_UNIQUEVALUE' => 'unique',
        'CHANNEL_AMAZON_ACTION_UNIQUEVALUE_COMMAND' => 'unique',
    ],
    'nY3g_channel_amazon_attribute' => [
        'AMAZON_ATTRIBUTE_AMAZON_ATTRIBUTE' => 'index',
        'CHANNEL_AMAZON_ATTRIBUTE_UNIQUEVALUE' => 'unique',
        'ID_ID' => 'index',
    ],
    'nY3g_channel_amazon_attribute_value' => [
        'ASIN_ASIN' => 'index',
        'CHANNEL_AMAZON_ATTRIBUTE_VALUE_UNIQUEVALUE' => 'unique',
        'ID_ID' => 'index',
        'PARENT_ID_PARENT_ID' => 'index',
    ],
    'nY3g_channel_amazon_defect' => [
        'CHANNEL_AMAZON_ACCOUNT_DEFECT_UNIQUEVALUE' => 'unique',
    ],
    'nY3g_channel_amazon_error_log' => [
        'ID_ID' => 'index',
    ],
    'nY3g_channel_amazon_listing' => [
        'ASIN_ASIN' => 'index',
        'CATALOG_PRODUCT_ID_CATALOG_PRODUCT_ID' => 'index',
        'CHANNEL_AMAZON_ACCOUNT_LISTING_UNIQUEVALUE' => 'unique',
        'CONDITION_CONDITION' => 'index',
        'IS_SHIP_IS_SHIP' => 'index',
        'LISTING_ID_LISTING_ID' => 'index',
        'LIST_STATUS_LIST_STATUS' => 'index',
        'MERCHANT_ID_MERCHANT_ID' => 'index',
    ],
    'nY3g_channel_amazon_listing_log' => [
        'ID_ID' => 'index',
    ],
    'nY3g_channel_amazon_listing_multiple' => [
        'CHANNEL_AMAZON_LISTING_MULTIPLE_UNIQUEVALUE' => 'unique',
    ],
    'nY3g_channel_amazon_listing_rule' => [
        'MERCHANT_ID_MERCHANT_ID' => 'index',
    ],
    'nY3g_channel_amazon_listing_variant' => [
        'CHANNEL_AMAZON_LISTING_VARIANT_UNIQUEVALUE' => 'unique',
    ],
    'nY3g_channel_amazon_order' => [
        'CHANNEL_AMAZON_ORDER_UNIQUEVALUE' => 'unique',
        'ORDER_ID_ORDER_ID' => 'index',
    ],
    'nY3g_channel_amazon_order_item' => [
        'CHANNEL_AMAZON_ORDER_ITEM_UNIQUEVALUE' => 'unique',
        'ORDER_ID_ORDER_ID' => 'index',
    ],
    'nY3g_channel_amazon_order_reserve' => [
        'CHANNEL_AMAZON_ORDER_RESERVE_UNIQUEVALUE' => 'unique',
        'ORDER_ID_ORDER_ID' => 'index',
    ],
    'nY3g_channel_amazon_order_tracking' => [
        'ORDER_ID_ORDER_ID' => 'index',
    ],
    'nY3g_channel_amazon_pricing_bestbuybox' => [
        'ASIN_ASIN' => 'index',
        'CHANNEL_AMAZON_PRICING_BESTBUYBOX_UNIQUEVALUE' => 'unique',
        'COUNTRY_CODE_COUNTRY_CODE' => 'index',
    ],
    'nY3g_channel_amazon_pricing_index' => [
        'ASIN_ASIN' => 'index',
        'CHANNEL_AMAZON_PRICING_INDEX_UNIQUEVALUE' => 'unique',
        'CONDITION_CONDITION' => 'index',
        'ID_ID' => 'index',
        'PARENT_ID_PARENT_ID' => 'index',
        'PRODUCT_ID_PRODUCT_ID' => 'index',
        'SHIPPING_CALCULATED_SHIPPING_CALCULATED' => 'index',
        'STOP_RULES_STOP_RULES' => 'index',
    ],
    'nY3g_channel_amazon_pricing_lowest' => [
        'ASIN_ASIN' => 'index',
        'COUNTRY_CODE_COUNTRY_CODE' => 'index',
    ],
    'nY3g_channel_amazon_pricing_rule' => [
        'ID_ID' => 'index',
    ],
    'nY3g_channel_amazon_quantity_index' => [
        'CHANNEL_AMAZON_QUANTITY_INDEX_UNIQUEVALUE' => 'unique',
        'ID_ID' => 'index',
    ],
];

/vendor/magento/module-amazon/Setup/Patch/Schema/DropLegacyPreV4Columns.php

/**
 * @var ModuleDataSetupInterface $moduleDataSetup
 */
private $moduleDataSetup;

private $columnsToDrop = [
    ['table' => 'nY3g_channel_amazon_account', 'column' => 'setup_step'],
    ['table' => 'nY3g_channel_amazon_action', 'column' => 'api_group'],
    ['table' => 'nY3g_channel_amazon_action', 'column' => 'api_action'],
    ['table' => 'nY3g_channel_amazon_action', 'column' => 'api_content'],
];

Hi @adrianbsystems Thanks for writing. As this doesn't appear to be a docs issue, but a codebase issue, we suggest you open a bug in the magento2 codebase. Thanks.