Completed
Push — master ( 647ef8...103d46 )
by zacksleo
10:04
created

m171114_094918_create_order_payment_record_table   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 15 2
A down() 0 4 1
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `order_payment_record`.
7
 */
8
class m171114_094918_create_order_payment_record_table extends Migration
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function up()
14
    {
15
        $tableOptions = null;
16
        if ($this->db->driverName === 'mysql') {
17
            $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
18
        }
19
        $this->createTable('{{%order_payment_record}}', [
20
            'id' => $this->primaryKey(),
21
            'order_sn' => $this->string()->notNull()->comment('订单编号'),
22
            'trace_no' => $this->string()->comment('交易号'),
23
            'amount' => $this->decimal(10, 2)->comment('总金额'),
24
            'created_at' => $this->integer()->comment('创建时间'),
25
            'updated_at' => $this->integer()->comment('更新时间'),
26
        ], $tableOptions);
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    public function down()
33
    {
34
        $this->dropTable('{{%order_payment_record}}');
35
    }
36
}
37