I've created a custom module, and I see the row in the setup_module
table. When I change my version and run magento setup:upgrade
, the version number updates as well. However, the table I defined is not being created. I also see the new module enabled in app/etc/config.php
I tried installing a module written by Magento, but I still see the same behavior - row is in setup_module
but table does not exist.
I tried deleting the row from setup_module
table and rerun magento setup:upgrade
to execute InstallSchema.php
, but the database tables aren't created even though the row is created setup_module
again.
I also tried incrementing the version number and try UpgradeSchema.php, but it doesn't execute even though row in setup_module
is updated.
I introduced errors in both InstallSchema.php
and UpgradeSchema.php
, but magento setup:upgrade
doesn't does not output the error messages.
I also tried recreating the installation, and ensuring the file permissions were correct (owned by magento:www-data
). Any other ideas?
I'm using v2.0.7 CE provided by DigitalOcean.
<?php
namespace Test\Project\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
// Get tables
$tableName = $installer->getTable('test_module');
// Create table
$table = $installer->getConnection()
->newTable($tableName)
->addColumn(
'id',
Table::TYPE_INTEGER,
null,
[
'identity' => true,
'unsigned' => true,
'nullable' => false,
'primary' => true
],
'ID'
)
->addColumn(
'title',
Table::TYPE_TEXT,
null,
['nullable' => false, 'default' => ''],
'Title'
)
->setOption('type', 'InnoDB')
->setOption('charset', 'utf8');
$installer->getConnection()->createTable($table);
$installer->endSetup();
} // close function install()
}
setup_module
table as well asetc/config.php
with value of1
setup:upgrade
, it doesn't output any errors. It's as if those files aren't being read.