This repository has been archived by the owner on Dec 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathUpgradeSchema.php
60 lines (52 loc) · 1.63 KB
/
UpgradeSchema.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Fontis Australia Extension for Magento 2
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/osl-3.0.php
*
* @category Fontis
* @package Fontis_Australia
* @copyright Copyright (c) 2017 Fontis Pty. Ltd. (https://www.fontis.com.au)
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
namespace Fontis\Australia\Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\ModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
/**
* @var InstallSchema
*/
protected $installSchema;
/**
* @param InstallSchema $installSchema
*/
public function __construct(InstallSchema $installSchema)
{
$this->installSchema = $installSchema;
}
/**
* Upgrade event
*
* @param SchemaSetupInterface $installer
* @param ModuleContextInterface $context
*/
public function upgrade(SchemaSetupInterface $installer, ModuleContextInterface $context)
{
$installer->startSetup();
// Don't run the upgrade process if the extension isn't already installed.
if (!$context->getVersion()) {
return;
}
if (version_compare($context->getVersion(), '0.3.0') < 0) {
$this->installSchema->createParcelTable($installer);
}
$installer->endSetup();
}
}