<?php

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

class AddVirtualDeviceProvince extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('virtual_devices', function (Blueprint $table) {
            $table->string('province', 15)->default("")->comment('所属省份');
            $table->integer('agent_id')->unsigned()->default(0)->comment('代理商ID');

            $table->index(['sim']);
            $table->index(['unique_key']);
            $table->index(['imsi']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('virtual_devices', function (Blueprint $table) {
            $table->dropColumn('province');
            $table->dropColumn('agent_id');
            $table->dropIndex("virtual_devices_sim_index");
            $table->dropIndex("virtual_devices_unique_key_index");
            $table->dropIndex("virtual_devices_imsi_index");
        });
    }
}
