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

up()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 15
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 12
nc 2
nop 0
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