m190803_101632_alter_file::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

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