<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('quest', function (Blueprint $table) {
            $table->unsignedInteger('dwPID')->nullable();
            $table->string('szName', 32)->index('name_idx');
            $table->string('szState', 64)->default('')->index('state_idx');
            $table->integer('lValue')->default(0);

            $table->index(['dwPID', 'szName', 'szState']);
            $table->foreign('dwPID')->references('id')->on('player');
        });
    }

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