m180124_082041_create_order_table::up()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 29
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 8.8571
c 0
b 0
f 0
cc 2
eloc 23
nc 2
nop 0
1
<?php
2
3
use yii\db\Migration;
4
5
/**
6
 * Handles the creation of table `order`.
7
 */
8
class m180124_082041_create_order_table 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...
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}}', [
20
            'id' => $this->primaryKey(),
21
            'sn' => $this->string()->notNull()->comment('订单号'),
22
            'game_id' => $this->smallInteger()->notNull()->unsigned()->comment('游戏ID'),
23
            'type' => $this->smallInteger()->notNull()->unsigned()->comment('订单分类'),
24
            'user_id' => $this->integer()->notNull()->unsigned()->comment('用户ID'),
25
            'count' => $this->integer()->notNull()->comment('数量'),
26
            'hours' => $this->integer()->notNull()->comment('时间'),
27
            'final_price' => $this->float()->notNull()->comment('final_price'),
28
            'equipment' => $this->smallInteger()->notNull()->comment('区服信息'),
29
            'serverinfo' => $this->string()->comment('详细区服信息'),
30
            'account' => $this->string()->notNull()->comment('用户帐号/游戏昵称'), //王者荣耀为QQ/微信帐号,吃鸡游戏为游戏昵称
31
            //'password' => $this->string()->comment('王者荣耀代打订单必须 需要用户帐号和密码'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
32
            'remark' => $this->string(100)->comment('备注'),
33
            'status' => $this->smallInteger()->notNull()->comment('订单状态'),
34
            'created_at' => $this->integer()->notNull()->comment('创建时间'),
35
            'updated_at' => $this->integer()->notNull()->comment('更新时间'),
36
            'payment_method' => $this->smallInteger()->notNull()->comment('支付方式'),
37
            //'client_id' => $this->string()->notNull()->defaultValue('')->comment('客户端'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
38
            'name' => $this->string()->notNull()->defaultValue('')->comment('订单名称'),
39
            //'description' => $this->string()->comment('描述'),
0 ignored issues
show
Unused Code Comprehensibility introduced by
74% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
40
        ], $tableOptions);
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function down()
47
    {
48
        $this->dropTable('{{%order}}');
49
    }
50
}
51