Passed
Push — develop ( f4298d...905a65 )
by Benjamin
02:59
created

m180910_122732_craft3_upgrade::safeUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace dukt\twitter\migrations;
4
5
use Craft;
6
use craft\db\Migration;
7
use dukt\twitter\fields\Tweet;
8
use dukt\twitter\widgets\SearchWidget;
9
10
/**
11
 * m180910_122732_craft3_upgrade migration.
12
 */
13
class m180910_122732_craft3_upgrade extends Migration
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function safeUp()
19
    {
20
        // Fields
21
        $this->update('{{%fields}}', [
22
            'type' => Tweet::class
23
        ], ['type' => 'Twitter_Tweet']);
24
25
        // Widgets
26
        $this->update('{{%widgets}}', [
27
            'type' => SearchWidget::class
28
        ], ['type' => 'Twitter_Search']);
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function safeDown()
35
    {
36
        echo "m180910_122732_craft3_upgrade cannot be reverted.\n";
37
        return false;
38
    }
39
}
40