InstallSchema.php fails to execute

by TylersSN   Last Updated August 13, 2019 23:09 PM - source

I've read various posts here but none of them have been helpful.

Steps I have taken:

  • Remove My_Module from setup_module in DB
  • Add Setup/InstallSchema.php
  • Clear generated/* directory
  • Clear cache
  • Execute magento setup:upgrade
  • I've also tried throwing an exception within the install method. No exception is ever thrown.
<?php

namespace My\Module\AttributeMapper\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use My\Module\AttributeMapper\Helper\Product\AttributeData;

/**
 * Upgrade the Catalog module DB scheme
 */
class InstallSchema implements InstallSchemaInterface
{
    /**
     * {@inheritdoc}
     * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
    {
        $setup->startSetup();

        $this->addCatalogEav($setup);

        $setup->endSetup();
    }

    /**
     * Add table which allows to hold product frontend actions like product view or comparison
     * with next definition: visitor or customer definition, product definition and added time in JS format
     *
     * @param SchemaSetupInterface $installer
     * @return void
     */
    private function addCatalogEav(SchemaSetupInterface $installer)
    {
        $catalogEavTable = $installer->getTable('catalog_eav_attribute');
        $installer->getConnection()->addColumn(
            $catalogEavTable,
            AttributeData::PRODUCT_ATTRIBUTE_OPTION_API_ATTRIBUTE_ID,
            [
                'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
                'comment' => 'API Attribute GUID Mapping for Product Attribute'
            ]
        );
    }
}

Tags : setup


Related Questions


Magento 2 - setup:install & setup:upgrade

Updated August 25, 2017 16:09 PM

Recurring.php and RecurringData.php

Updated March 24, 2018 13:09 PM


Magento 2 - setup:di:compile

Updated July 18, 2017 09:09 AM