<?php

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

class AddFieldToWorkingSurface0607 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('working_surface', function (Blueprint $table) {
            $table->tinyInteger('working_area')->default('1')->after('surface_name')->comment('矿井区域 1:默认 2:关键区域 3:工作面 4:物资 5:煤场');
        });

        \Modules\Mine\Entities\WorkingSurface::where('id', '>', 0)->update(
            [
                'working_area' => 3
            ]
        );
    }

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