Eu tenho um InstallSchema.php que simplesmente não cria a tabela necessária no banco de dados. O código do esquema é o seguinte:
<?php
namespace MyVendor\Helpdesk\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
public function install(SchemaSetupInterface $setup,
ModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
$table = $installer->getConnection()
->newTable($installer->getTable('myvendor_helpdesk_ticket'))
->addColumn(
'ticket_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'Ticket Id'
)
->addColumn(
'customer_id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['unsigned' => true],
'Customer Id'
)
->addColumn(
'title',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
null,
['nullable' => false],
'Title'
)
->addColumn(
'severity',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['nullable' => false],
'Severity'
)
->addColumn(
'created_at',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
['nullable' => false],
'Created At'
)
->addColumn(
'status',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
null,
['nullable' => false],
'Status'
)
->addIndex(
$installer->getIdxName('myvendor_helpdesk_ticket', ['customer_id']),
['customer_id']
)
->addForeignKey(
$installer->getFkName('myvendor_helpdesk_ticket', 'customer_id', 'customer_entity', 'entity_id'),
'customer_id',
$installer->getTable('customer_entity'),
'entity_id',
\Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL
)
->setComment('myvendor Helpdesk Ticket');
$installer->getConnection()->createTable($table);
$installer->endSetup();
}
}
Eu executei os seguintes comandos:
php bin/magento setup:upgrade
php bin/magento setup:db-schema:upgrade
Nenhum erro foi fornecido, ainda assim, quando chego à minha página, recebo o seguinte erro:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.myvendor_helpdesk_ticket' doesn't exist
Por favor ajude.
setup_module
o registro commodule = 'MyVendor_Helpdesk'