I've the following setup:
Company/Custom/etc/module.xml:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Custom" setup_version="1.0.6"></module>
</config>
Company/Custom/Setup/UpgradeSchema.php:
<?php
namespace Company\Custom\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$eavTable = $installer->getTable('customer_entity');
$columns = [
'custom' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
'length' => '1',
'nullable' => true,
'comment' => 11,
],
];
$connection = $installer->getConnection();
foreach ($columns as $name => $definition) {
$connection->addColumn($eavTable, $name, $definition);
}
$installer->endSetup();
}
}
I've removed the module from the setup_module
table and run the upgrade commands.
Also, the module is appears in the dashboard and its enabled.
The problem is that table is not created in database after I run the scripts but if I put errors in the php file, the upgrade scripts run without error.
As you can see I incremented the module version in the module.xml
.
Thanks.