<?php

use App\Station;
use App\StationType;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddMonitorDefaultStationAndStationHardwareIdColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('stations', function (Blueprint $table) {
            $table->string('remark')->nullable();
        });
        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
        Station::query()->firstOrCreate(['name'=>'料箱监视器01','sequence'=>1,'station_type_id'=>$stationType['id']]);
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('stations', function (Blueprint $table) {
            $table->dropColumn('remark');
        });
    }
}
