<?php

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

class CreateEventOrderItem extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('event_order_item', function (Blueprint $table) {

            $table->increments('id');
            $table->timestamps();

            $table->integer('memberUserId')->comment('用户ID')->nullable();
            $table->integer('orderId')->comment('订单ID')->nullable();

            $table->integer('eventId')->comment('活动ID')->nullable();

            $table->string('checkCode', 20)->comment('签到码')->nullable();

            /** @see \App\Types\EventOrderStatus */
            $table->tinyInteger('orderStatus')->comment('订单状态')->nullable();

            /** @see \App\Types\EventOrderItemStatus */
            $table->tinyInteger('status')->comment('状态')->nullable();

            $table->string('fieldCustom1', 100)->comment('字段')->nullable();
            $table->string('fieldCustom2', 100)->comment('字段')->nullable();
            $table->string('fieldCustom3', 100)->comment('字段')->nullable();
            $table->string('fieldCustom4', 100)->comment('字段')->nullable();
            $table->string('fieldCustom5', 100)->comment('字段')->nullable();

            $table->index(['memberUserId']);
            $table->index(['orderId']);
            $table->unique(['checkCode']);


        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
    }
}
