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

m180910_122732_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\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