m190803_101632_alter_file   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeDown() 0 5 1
A safeUp() 0 8 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Class m190803_101632_alter_file
7
 */
8
class m190803_101632_alter_file extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createIndex('file-class', '{{%file}}', 'class');
16
        $this->createIndex('file-object_id', '{{%file}}', 'object_id');
17
        $this->createIndex('file-field', '{{%file}}', 'field');
18
        $this->createIndex('file-type', '{{%file}}', 'type');
19
        $this->createIndex('file-hash', '{{%file}}', 'hash');
20
        $this->createIndex('file-filename', '{{%file}}', 'filename');
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function safeDown()
27
    {
28
        echo "m190803_101632_alter_file cannot be reverted.\n";
29
30
        return false;
31
    }
32
33
}
34