m200730_082622_create_currency_rate_table   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

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