<?php

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

class CreateRegionsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('regions', function (Blueprint $table) {
            $table->id();
            $table->bigInteger("parent_id")->nullable()->index()->comment("父级");
            $table->string("name")->comment("名称");
            $table->tinyInteger("type")->default(1)->comment("类型(行政区划)");
            $table->string("code")->nullable()->comment("邮编");
        });
    }

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