m200730_062450_create_account_table   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A safeUp() 0 20 1
A safeDown() 0 3 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `{{%account}}`.
7
 */
8
class m200730_062450_create_account_table extends Migration
9
{
10
    /**
11
     * {@inheritdoc}
12
     */
13
    public function safeUp()
14
    {
15
        $this->createTable('{{%account}}', [
16
            'id' => $this->primaryKey(),
17
            'user_id' => $this->integer()->notNull(),
18
            'name' => $this->string(120)->notNull(),
19
            'type' => $this->tinyInteger()->notNull(),
20
            'color' => $this->string(7)->notNull(),
21
            'balance_cent' => $this->bigInteger()->defaultValue(0),
22
            'currency_code' => $this->string(3)->notNull(),
23
            'status' => $this->tinyInteger()->defaultValue(1),
24
            'exclude_from_stats' => $this->tinyInteger()->defaultValue(0),
25
            'credit_card_limit' => $this->integer(),
26
            'credit_card_repayment_day' => $this->tinyInteger(),
27
            'credit_card_billing_day' => $this->tinyInteger(),
28
            'created_at' => $this->timestamp()->defaultValue(null),
29
            'updated_at' => $this->timestamp()->defaultValue(null),
30
        ]);
31
32
        $this->createIndex('account_user_id', '{{%account}}', 'user_id');
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function safeDown()
39
    {
40
        $this->dropTable('{{%account}}');
41
    }
42
43
}
44