<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('agencies', function (Blueprint $table) {
            $table->id();
            $table->integer('partner_id')->unsigned();
            $table->enum('grade', ['P','C'])->comment("代理等级 P:省级，C:市级");
            $table->string('pro_id', 6)->comment("省codeid");
            $table->string('city_id', 6)->comment("市codeid")->nullable();
            $table->string('province', 50)->nullable();
            $table->string('city', 50)->nullable();
            $table->timestamps();
            $table->unique(['partner_id','pro_id', 'city_id']);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('agencies');
    }
};
