m000000_000000_api_user::safeUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 16
rs 9.8666
c 0
b 0
f 0
1
<?php
2
3
use yii\db\Migration;
4
5
class m000000_000000_api_user 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...
6
{
7
    /**
8
     * @inheritdoc
9
     */
10
    public function safeUp()
11
    {
12
        $this->createTable('user', [
13
            'id'                => $this->primaryKey(),
14
            'email'             => $this->string(255)->notNull(),
15
            'username'          => $this->string(255)->notNull(),
16
            'password'          => $this->string(255)->notNull(),
17
            'verified'          => $this->integer()->defaultValue(0),
18
            'otp_secret'        => $this->string(600),
19
            'otp_enabled'       => $this->integer()->defaultValue(0),
20
            'created_at'        => $this->integer(),
21
            'updated_at'        => $this->integer()
22
        ]);
23
        
24
        $this->createIndex('user__email_unique_index', 'user', ['email'], true);
25
        $this->createIndex('user__username_unique_index', 'user', ['username'], true);
26
    }
27
    
28
    /**
29
     * @inheritdoc
30
     */
31
    public function safeDown()
32
    {
33
        $this->dropTable('user');
34
    }
35
}
36