<?php

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

class CreateMallCartsTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('mall_carts', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('shop_id')->index()->comment('所属店铺');
            $table->unsignedBigInteger('user_id')->index();
            $table->unsignedBigInteger('sku_id')->comment('加入购物车的商品条目');
            $table->unsignedInteger('qty')->default(1)->comment('数量');
            $table->timestamps();
        });
    }

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

}
