Tengo un InstallSchema.php que simplemente no crea la tabla necesaria en la base de datos. El código del esquema es de barbecho:
<?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();
}
}
He ejecutado los siguientes comandos:
php bin/magento setup:upgrade
php bin/magento setup:db-schema:upgrade
No se dieron errores, sin embargo, cuando llego a mi página recibo el siguiente error:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.myvendor_helpdesk_ticket' doesn't exist
Por favor ayuda.
setup_module
el registro conmodule = 'MyVendor_Helpdesk'