-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from rensieeee/master
Feature - Full 2.2.X compatibility
- Loading branch information
Showing
3 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
/** | ||
* A Magento 2 module named Experius/EmailCatcher | ||
* Copyright (C) 2019 Experius | ||
* | ||
* This file included in Experius/EmailCatcher is licensed under OSL 3.0 | ||
* | ||
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* Please see LICENSE.txt for the full text of the OSL 3.0 license | ||
*/ | ||
|
||
namespace Experius\EmailCatcher\Setup; | ||
|
||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\Setup\InstallSchemaInterface; | ||
|
||
class InstallSchema implements InstallSchemaInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function install( | ||
SchemaSetupInterface $setup, | ||
ModuleContextInterface $context | ||
) { | ||
$installer = $setup; | ||
$installer->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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* A Magento 2 module named Experius/EmailCatcher | ||
* Copyright (C) 2019 Experius | ||
* | ||
* This file included in Experius/EmailCatcher is licensed under OSL 3.0 | ||
* | ||
* http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* Please see LICENSE.txt for the full text of the OSL 3.0 license | ||
*/ | ||
namespace Experius\EmailCatcher\Setup; | ||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function upgrade( | ||
SchemaSetupInterface $setup, | ||
ModuleContextInterface $context | ||
) { | ||
if (version_compare($context->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' | ||
] | ||
); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e69e8c1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)