<?php

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

class ModifyComplaintsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('complaints', function (Blueprint $table) {
            $table->unsignedBigInteger('moderator_checking_id')->nullable();
            $table->unsignedBigInteger('feed_id')->index();

            $table->dropColumn('complaintable_type');
            $table->dropColumn('complaintable_id');
            $table->dropColumn('user_checking_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('complaints', function (Blueprint $table) {
            $table->dropColumn('moderator_checking_id');
            $table->dropColumn('feed_id');
            $table->unsignedBigInteger('user_checking_id')->nullable();
            $table->morphs('complaintable');
        });
    }
}
