m151126_091910_add_unique_index   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 12
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 4 1
A safeDown() 0 4 1
1
<?php
2
/**
3
 * @link http://phe.me
4
 * @copyright Copyright (c) 2014 Pheme
5
 * @license MIT http://opensource.org/licenses/MIT
6
 */
7
8
use yii\db\Migration;
9
10
class m151126_091910_add_unique_index extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
11
{
12
    public function safeUp()
13
    {
14
        $this->createIndex('settings_unique_key_section', '{{%settings}}', ['section', 'key'], true);
15
    }
16
17
    public function safeDown()
18
    {
19
        $this->dropIndex('settings_unique_key_section', '{{%settings}}');
20
    }
21
}
22