<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMallGoodsSkusTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('mall_goods_skus', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('goods_id')->index();
            $table->string('unit')->nullable()->comment('商品单元编号');
            $table->string('cover')->nullable();
            $table->decimal('price');
            $table->decimal('score')->comment('积分/原石');
            $table->decimal('assets', 8, 2)->comment('资产');
            $table->integer('stock')->default(0);
            $table->decimal('weight')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('mall_goods_skus');
        Schema::dropIfExists('mall_goods_sku_spec');
    }

}
