Skip to content

Commit

Permalink
[ZAI-229] Remove UpgradeSchema.php; Create InstallSchema.php & Uninst…
Browse files Browse the repository at this point in the history
…all.php scripts. Update version number.
  • Loading branch information
travish committed Oct 29, 2020
1 parent 3ac4540 commit 83745c8
Show file tree
Hide file tree
Showing 5 changed files with 133 additions and 40 deletions.
98 changes: 98 additions & 0 deletions Setup/InstallSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<?php


namespace Zaius\Engage\Setup;

use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

/**
* @codeCoverageIgnore
*/
class InstallSchema implements InstallSchemaInterface
{
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
/**
* Create table 'zaius_job'
*/
$table = $setup->getConnection()
->newTable($setup->getTable('zaius_job'))
->addColumn(
'id',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
'id'
)
->addColumn(
'handler',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
null,
['nullable' => false],
'handler'
)
->addColumn(
'queue',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => false, 'default' => 'default'],
'queue'
)
->addColumn(
'attempts',
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
null,
['unsigned' => true, 'nullable' => false, 'default' => 0],
'attempts'
)
->addColumn(
'run_at',
\Magento\Framework\DB\Ddl\Table::TYPE_DATETIME,
null,
['nullable' => true],
'run_at'
)
->addColumn(
'locked_at',
\Magento\Framework\DB\Ddl\Table::TYPE_DATETIME,
null,
['nullable' => true],
'locked_at'
)
->addColumn(
'locked_by',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
255,
['nullable' => true],
'locked_by'
)
->addColumn(
'failed_at',
\Magento\Framework\DB\Ddl\Table::TYPE_DATETIME,
null,
['nullable' => true],
'failed_at'
)
->addColumn(
'error',
\Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
null,
['nullable' => true],
'error'
)
->addColumn(
'created_at',
\Magento\Framework\DB\Ddl\Table::TYPE_DATETIME,
null,
['nullable' => false],
'created_at'
)->setComment("Zaius Job Table");
$setup->getConnection()->createTable($table);
}
}
33 changes: 33 additions & 0 deletions Setup/Uninstall.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php


namespace Zaius\Engage\Setup;

use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\UninstallInterface as UninstallInterface;
/**
* Class Uninstall
*/
class Uninstall implements UninstallInterface
{
/**
* Atwix Sample Table Name
*/
const ZAIUS_JOB = 'zaius_job';
/**
* Invoked when remove-data flag is set during module uninstall
*
* @param SchemaSetupInterface $setup
* @param ModuleContextInterface $context
*
* @return void
*/
public function uninstall(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();
$connection = $setup->getConnection();
$connection->dropTable($connection->getTableName(self::ZAIUS_JOB));
$setup->endSetup();
}
}
38 changes: 0 additions & 38 deletions Setup/UpgradeSchema.php

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "magento2-module",
"description": "The Zaius Engage Connector for Magento 2.",
"license": "MIT",
"version": "1.0.6",
"version": "1.0.7",
"require": {
"php": ">=5.5",
"zaius/zaius-php-sdk": "^1.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Zaius_Engage" setup_version="1.0.6">
<module name="Zaius_Engage" setup_version="1.0.7">
<sequence>
<module name="Magento_Catalog"/>
<module name="Magento_CatalogSearch"/>
Expand Down

0 comments on commit 83745c8

Please sign in to comment.