Passed
Push — develop ( e7d947...811916 )
by Andrew
03:56
created

m190625_151715_add_indexes::safeDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace nystudio107\webperf\migrations;
4
5
use Craft;
0 ignored issues
show
Bug introduced by
The type Craft was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use craft\db\Migration;
0 ignored issues
show
Bug introduced by
The type craft\db\Migration was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
8
/**
9
 * m190625_151715_add_indexes migration.
0 ignored issues
show
Coding Style introduced by
Doc comment short description must start with a capital letter
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
11
class m190625_151715_add_indexes extends Migration
0 ignored issues
show
Coding Style introduced by
Class name must begin with a capital letter
Loading history...
Coding Style introduced by
Class name is not valid; consider M190625_151715_Add_Indexes instead
Loading history...
12
{
13
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
14
     * @inheritdoc
15
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
16
    public function safeUp()
17
    {
18
        // Add webperf_data_samples indexes
19
        $this->createIndex(
20
            $this->db->getIndexName(
21
                '{{%webperf_data_samples}}',
22
                'dateCreated',
23
                false
24
            ),
25
            '{{%webperf_data_samples}}',
26
            'dateCreated',
27
            false
28
        );
29
        $this->createIndex(
30
            $this->db->getIndexName(
31
                '{{%webperf_data_samples}}',
32
                'requestId',
33
                false
34
            ),
35
            '{{%webperf_data_samples}}',
36
            'requestId',
37
            false
38
        );
39
        // Add webperf_error_samples indexes
40
        $this->createIndex(
41
            $this->db->getIndexName(
42
                '{{%webperf_error_samples}}',
43
                'dateCreated',
44
                false
45
            ),
46
            '{{%webperf_error_samples}}',
47
            'dateCreated',
48
            false
49
        );
50
        $this->createIndex(
51
            $this->db->getIndexName(
52
                '{{%webperf_error_samples}}',
53
                'requestId',
54
                false
55
            ),
56
            '{{%webperf_error_samples}}',
57
            'requestId',
58
            false
59
        );
60
    }
61
62
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
63
     * @inheritdoc
64
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
65
    public function safeDown()
66
    {
67
        echo "m190625_151715_add_indexes cannot be reverted.\n";
68
        return false;
69
    }
70
}
71