<?php

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

class AddColumnMaterialTaskTypeDropStationMissionTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::dropIfExists('station_mission_batch_types');
        Schema::dropIfExists('station_mission_batches');
        Schema::dropIfExists('station_mission_commodities');
        Schema::dropIfExists('station_mission_material_boxes');
        Schema::table('station_task_material_boxes',function(Blueprint $table){
            $table->enum('type',['取','放','移动']);
            $table->bigInteger('station_task_batch_id')->index()->nullable();
        });
        Schema::table('station_task_commodities',function(Blueprint $table){
            $table->bigInteger('station_task_batch_id')->index()->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('station_task_material_boxes',function(Blueprint $table){
            $table->dropColumn('type');
            $table->dropColumn('station_task_batch_id');
        });
        Schema::table('station_task_commodities',function(Blueprint $table){
            $table->dropColumn('station_task_batch_id');
        });
    }
}
