<?php

use yii\db\Migration;
use yii\db\Schema;

/**
 * Handles the creation of table `{{%order_sku}}`.
 */
class m181111_135926_create_order_sku_table extends Migration
{

    public $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('{{%order_sku}}', [
            'id' => Schema::TYPE_PK,
            'order_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '订单ID'",
            'goods_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '商品ID'",
            'package_id' => Schema::TYPE_INTEGER . "(11) NOT NULL COMMENT '包裹ID'",
            'sku_id' => Schema::TYPE_INTEGER . "(11) COMMENT '规格ID'",
            'quantity' => Schema::TYPE_INTEGER. "(11) NOT NULL COMMENT '数量'",
            'unit_price' => Schema::TYPE_DECIMAL . "(10,2) 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 '状态'",
        ]);
    }


    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('{{%order_sku}}');
    }
}
