Files
2017-11-14 15:04:59 +01:00

96 lines
2.3 KiB
PHP
Executable File

<?php
/**
* Mageplaza
*
* NOTICE OF LICENSE
*
* This source file is subject to the mageplaza.com license that is
* available through the world-wide-web at this URL:
* https://mageplaza.com/LICENSE.txt
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this extension to newer
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_Smtp
* @copyright Copyright (c) 2017 Mageplaza (https://www.mageplaza.com/)
* @license http://mageplaza.com/LICENSE.txt
*/
namespace Mageplaza\Smtp\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
/**
* Class InstallSchema
* @package Mageplaza\Smtp\Setup
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* install tables
*
* @param \Magento\Framework\Setup\SchemaSetupInterface $setup
* @param \Magento\Framework\Setup\ModuleContextInterface $context
*
* @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(
SchemaSetupInterface $setup,
ModuleContextInterface $context
)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('mageplaza_smtp_log') && version_compare($context->getVersion(), '1.0.0') < 0) {
$table = $installer->getConnection()->newTable($installer->getTable('mageplaza_smtp_log'))
->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'Log ID'
)->addColumn(
'subject',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable => false'],
'Email Subject'
)->addColumn(
'email_content',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'64k',
[],
'Email Content'
)->addColumn(
'status',
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
1,
['nullable' => false],
'Status'
)->addColumn(
'created_at',
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
null,
[],
'Created At'
)->addIndex(
$installer->getIdxName('mageplaza_smtp_log', ['status']),
['status']
);
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
}