123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- use yii\db\Migration;
- use yii\db\Schema;
- /**
- * Handles the creation of table `{{%order}}`.
- */
- class m181111_134257_create_order_table extends Migration
- {
- public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
- /**
- * @inheritdoc
- */
- public function up()
- {
- $this->createTable('{{%order}}', [
- 'id' => Schema::TYPE_PK,
- 'user_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '用户ID'",
- 'out_trade_no' => Schema::TYPE_STRING . "(32) NOT NULL COMMENT '商户订单号'",
- 'order_no' => Schema::TYPE_STRING . "(16) NOT NULL COMMENT '订单号'",
- 'total_amount' => Schema::TYPE_DECIMAL . "(10,2) NOT NULL COMMENT '订单总金额'",
- 'pay_amount' => Schema::TYPE_DECIMAL . "(10,2) NOT NULL COMMENT '实付金额'",
- 'pay_time' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '支付时间'",
- 'remark' => Schema::TYPE_STRING . "(100) NOT NULL COMMENT '备注'",
- 'receiver_name' => Schema::TYPE_STRING . "(20) NOT NULL COMMENT '收件人姓名'",
- 'receiver_tel' => Schema::TYPE_STRING . "(11) NOT NULL COMMENT '收件人电话'",
- 'receiver_address' => Schema::TYPE_STRING . "(200) NOT NULL COMMENT '收件人地址'",
- 'created_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
- 'updated_at' => Schema::TYPE_INTEGER . "(11) NOT NULL",
- 'status' => Schema::TYPE_SMALLINT . "(1) NOT NULL DEFAULT '1' COMMENT '状态'",
- 'detail' => Schema::TYPE_STRING . "(300) COMMENT '订单详情'",
- ]);
- }
- /**
- * @inheritdoc
- */
- public function down()
- {
- $this->dropTable('{{%order}}');
- }
- }
|