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

m180910_130202_craft3_upgrade::safeDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
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