<?php

use App\Authority;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class AddAuthoritiesAndChangeInventoryAccounts extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        (new Authority(['name'=>'人事管理-临时工报表-编辑备注','alias_name'=>'人事管理-临时工报表-编辑备注']))->save();
//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘','局部盘点')");
        Schema::table('inventory_accounts', function (Blueprint $table) {
            $table->string('remark')->nullable()->comment('备注');
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Authority::where('name','人事管理-临时工报表-编辑备注')->delete();
//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘')");
        Schema::table('inventory_accounts', function (Blueprint $table) {
            $table->dropColumn('remark');
        });
    }
}
