Passed
Push — develop ( c511ae...c7368a )
by Benjamin
05:05
created

m180910_130202_craft3_upgrade   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 11 1
A safeDown() 0 4 1
1
<?php
2
3
namespace dukt\analytics\migrations;
4
5
use Craft;
6
use craft\db\Migration;
7
use dukt\analytics\fields\Report as ReportField;
8
use dukt\analytics\widgets\Report as ReportWidget;
9
10
/**
11
 * m180910_130202_craft3_upgrade migration.
12
 */
13
class m180910_130202_craft3_upgrade extends Migration
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function safeUp()
19
    {
20
        // Fields
21
        $this->update('{{%fields}}', [
22
            'type' => ReportField::class
23
        ], ['type' => 'Analytics_Report']);
24
25
        // Widgets
26
        $this->update('{{%widgets}}', [
27
            'type' => ReportWidget::class
28
        ], ['type' => 'Analytics_Report']);
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function safeDown()
35
    {
36
        echo "m180910_130202_craft3_upgrade cannot be reverted.\n";
37
        return false;
38
    }
39
}
40