<?php

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

class AddRelationColumnAndDropTableChildren extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('station_tasks', function (Blueprint $table) {
            $table->string('station_taskable_type');
            $table->bigInteger('station_taskable_id');
            $table->index('station_taskable_id','station_taskable_type');
        });
        Schema::drop('station_task_children');
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('station_tasks', function (Blueprint $table) {
            //
        });
        Schema::create('station_task_children', function (Blueprint $table) {
            $table->id();
        });
    }
}
