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 |
|
|
|
|
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('王者荣耀代打订单必须 需要用户帐号和密码'), |
|
|
|
|
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('客户端'), |
|
|
|
|
38
|
|
|
'name' => $this->string()->notNull()->defaultValue('')->comment('订单名称'), |
39
|
|
|
//'description' => $this->string()->comment('描述'), |
|
|
|
|
40
|
|
|
], $tableOptions); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @inheritdoc |
45
|
|
|
*/ |
46
|
|
|
public function down() |
47
|
|
|
{ |
48
|
|
|
$this->dropTable('{{%order}}'); |
49
|
|
|
} |
50
|
|
|
} |
51
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.