Skip to content

Commit 5dacda7

Browse files
authored
Fix for issue PCAPredict#25
Fix for issue PCAPredict#25 Table 'pcapredict_tag_settingsdata' doesn't exist
1 parent 4b24a7b commit 5dacda7

File tree

1 file changed

+17
-20
lines changed

1 file changed

+17
-20
lines changed

Diff for: Setup/UpgradeSchema.php

+17-20
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,42 @@
22

33
namespace PCAPredict\Tag\Setup;
44

5-
use Magento\Framework\Setup\UpgradeSchemaInterface;
5+
use Magento\Framework\DB\Ddl\Table;
66
use Magento\Framework\Setup\ModuleContextInterface;
77
use Magento\Framework\Setup\SchemaSetupInterface;
8-
use Magento\Framework\DB\Ddl\Table;
8+
use Magento\Framework\Setup\UpgradeSchemaInterface;
99

1010
// Upgrade will only trigger if the setup_version in the module.xml is increased.
1111
class UpgradeSchema implements UpgradeSchemaInterface
1212
{
13-
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context){
14-
13+
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
14+
{
1515
$setup->startSetup();
16-
17-
if(!$context->getVersion()) {
18-
// No previous version found.
19-
}
20-
21-
if (version_compare($context->getVersion(), '2.0.7') < 0) {
2216

17+
if (version_compare($context->getVersion(), '2.0.7', '<')) {
2318
// Get module table
2419
$tableName = $setup->getTable('pcapredict_tag_settingsdata');
2520

2621
// Check if the table already exists
27-
if ($setup->getConnection()->isTableExists($tableName) == true) {
28-
22+
if ($setup->getConnection()->isTableExists($tableName) === true) {
2923
// Remove any columns we don't need.
3024
$setup->getConnection()->dropColumn($tableName, 'update_time');
3125

3226
// Add the version column so we can record what version of the app the creds were created from.
3327
// In UpgradeData we set this column to the current version.
34-
$setup->getConnection()->addColumn($tableName, 'module_version',
35-
[
36-
'type' => Table::TYPE_TEXT,
37-
'length' => 16,
38-
'nullable' => true,
39-
'comment' => 'Created With App Version'
40-
]);
28+
$setup->getConnection()->addColumn(
29+
$tableName,
30+
'module_version',
31+
[
32+
'type' => Table::TYPE_TEXT,
33+
'length' => 16,
34+
'nullable' => true,
35+
'comment' => 'Created With App Version',
36+
]
37+
);
4138
}
4239
}
4340

4441
$setup->endSetup();
4542
}
46-
}
43+
}

0 commit comments

Comments
 (0)