2
2
3
3
namespace PCAPredict \Tag \Setup ;
4
4
5
- use Magento \Framework \Setup \ UpgradeSchemaInterface ;
5
+ use Magento \Framework \DB \ Ddl \ Table ;
6
6
use Magento \Framework \Setup \ModuleContextInterface ;
7
7
use Magento \Framework \Setup \SchemaSetupInterface ;
8
- use Magento \Framework \DB \ Ddl \ Table ;
8
+ use Magento \Framework \Setup \ UpgradeSchemaInterface ;
9
9
10
10
// Upgrade will only trigger if the setup_version in the module.xml is increased.
11
11
class UpgradeSchema implements UpgradeSchemaInterface
12
12
{
13
- public function upgrade (SchemaSetupInterface $ setup , ModuleContextInterface $ context ){
14
-
13
+ public function upgrade (SchemaSetupInterface $ setup , ModuleContextInterface $ context )
14
+ {
15
15
$ setup ->startSetup ();
16
-
17
- if (!$ context ->getVersion ()) {
18
- // No previous version found.
19
- }
20
-
21
- if (version_compare ($ context ->getVersion (), '2.0.7 ' ) < 0 ) {
22
16
17
+ if (version_compare ($ context ->getVersion (), '2.0.7 ' , '< ' )) {
23
18
// Get module table
24
19
$ tableName = $ setup ->getTable ('pcapredict_tag_settingsdata ' );
25
20
26
21
// Check if the table already exists
27
- if ($ setup ->getConnection ()->isTableExists ($ tableName ) == true ) {
28
-
22
+ if ($ setup ->getConnection ()->isTableExists ($ tableName ) === true ) {
29
23
// Remove any columns we don't need.
30
24
$ setup ->getConnection ()->dropColumn ($ tableName , 'update_time ' );
31
25
32
26
// Add the version column so we can record what version of the app the creds were created from.
33
27
// 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
+ );
41
38
}
42
39
}
43
40
44
41
$ setup ->endSetup ();
45
42
}
46
- }
43
+ }
0 commit comments