m170324_000002_remove_old_widgets   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 5 1
A safeUp() 0 7 1
1
<?php
2
3
namespace dukt\analytics\migrations;
4
5
use craft\db\Migration;
6
7
/**
8
 * The class name is the UTC timestamp in the format of mYYMMDD_HHMMSS_pluginHandle_migrationName
9
 */
10
class m170324_000002_remove_old_widgets extends Migration
11
{
12
    /**
13
     * Any migration code in here is wrapped inside of a transaction.
14
     *
15
     * @return bool
16
     */
17
    public function safeUp()
18
    {
19
        $this->delete('{{%widgets}}', ['type' => 'Analytics_Chart']);
20
        $this->delete('{{%widgets}}', ['type' => 'Analytics_Stats']);
21
        $this->delete('{{%widgets}}', ['type' => 'Analytics_Reports']);
22
23
        return true;
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function safeDown()
30
    {
31
        echo "m170324_000002_remove_old_widgets cannot be reverted.\n";
32
33
        return false;
34
    }
35
}
36