<?php

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

class ChangeProcessDailyParticipantsDeleteColumnStatus extends Migration
{

    protected $authNamesDel=[
        '人事管理-任务审核'
    ];
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('process_daily_participants',function (Blueprint $table){
            $table->dropColumn('status');
        });
        foreach ($this->authNamesDel as $name){
            \App\Authority::where(['name'=>$name,'alias_name'=>$name])->delete();
        }
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('process_daily_participants',function (Blueprint $table){
            $table->enum('status',['已审核','未审核'])->after('remark')->default('未审核')->comment('状态');
        });
        foreach ($this->authNamesDel as $name){
            \App\Authority::create(['name'=>$name,'alias_name'=>$name]);
        }
    }
}
