diff --git a/Setup/InstallSchema.php b/Setup/InstallSchema.php new file mode 100644 index 0000000..08cd53d --- /dev/null +++ b/Setup/InstallSchema.php @@ -0,0 +1,82 @@ +startSetup(); + $table_experius_emailcatcher = $setup->getConnection()->newTable($setup->getTable('experius_emailcatcher')); + $table_experius_emailcatcher->addColumn( + 'emailcatcher_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true, 'unsigned' => true,], + 'Entity ID' + ); + $table_experius_emailcatcher->addColumn( + 'to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'To Email Address' + ); + $table_experius_emailcatcher->addColumn( + 'from', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'From Email Address' + ); + $table_experius_emailcatcher->addColumn( + 'subject', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Subject' + ); + $table_experius_emailcatcher->addColumn( + 'body', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + null, + [], + 'Email Body' + ); + $table_experius_emailcatcher->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Created At' + ); + $table_experius_emailcatcher->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Store Id' + ); + $setup->getConnection()->createTable($table_experius_emailcatcher); + $setup->endSetup(); + } +} diff --git a/Setup/UpgradeSchema.php b/Setup/UpgradeSchema.php new file mode 100644 index 0000000..75eb677 --- /dev/null +++ b/Setup/UpgradeSchema.php @@ -0,0 +1,58 @@ +getVersion(), "1.0.1", "<")) { + $connection = $setup->getConnection(); + if (!$connection->tableColumnExists($setup->getTable('experius_emailcatcher'), 'recipient')) { + $connection->changeColumn( + $setup->getTable('experius_emailcatcher'), + 'to', + 'recipient', + ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT] + ); + } + if (!$connection->tableColumnExists($setup->getTable('experius_emailcatcher'), 'sender')) { + $connection->changeColumn( + $setup->getTable('experius_emailcatcher'), + 'from', + 'sender', + ['type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT] + ); + } + } + if (version_compare($context->getVersion(), "1.0.2", "<")) { + $connection = $setup->getConnection(); + if (!$connection->tableColumnExists($setup->getTable('experius_emailcatcher'), 'template_identifier')) { + $connection->addColumn( + $setup->getTable('experius_emailcatcher'), + 'template_identifier', + [ + 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 'nullable' => true, + 'comment' => 'Email Template Identifier' + ] + ); + } + } + } +} diff --git a/etc/module.xml b/etc/module.xml index d1fff14..99fd838 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,6 +1,6 @@ - +