<?php

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

class AddColumnOuterTableOwnerFeeDetails extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        \App\ValueStore::query()->firstOrCreate(["name"=>"wave_detail_last_sync_date"]);
        Schema::table('owner_fee_details', function (Blueprint $table) {
            $table->bigInteger("outer_id")->nullable()->index()->comment("关联表ID");
            $table->string("outer_table_name")->nullable()->comment("关联表名称");
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        \App\ValueStore::query()->where("name","wave_detail_last_sync_date")->delete();
        Schema::table('owner_fee_details', function (Blueprint $table) {
            $table->dropColumn("outer_id");
            $table->dropColumn("outer_table_name");
        });
    }
}
