<?php

use App\Classes\ValueObjects\Constants\RemarkTypes;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateRemarksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('remarks', function (Blueprint $table) {
            $table->id();
            $table->morphs('owner');
            $table->bigInteger('commenter_id')->unsigned()->index();
            $table->string('content',200);
            $table->integer('type')->default(RemarkTypes::INTERNAL);
            $table->softDeletes();
            $table->timestamps();
        });

        Schema::table('remarks', function (Blueprint $table) {
            $table->string('owner_type', 191)->change();
        });
    }

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