<?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('member_address', function (Blueprint $table) {
            $table->comment('用户地址');
            $table->increments('id');
            $table->unsignedBigInteger('user_id')->comment('用户编号');
            $table->string('location')->default('')->comment('定位地址');
            $table->string('detail')->nullable()->comment('详细地址');
            $table->string('province')->default('')->comment('省');
            $table->string('city')->default('')->comment('市');
            $table->string('district')->default('')->comment('区');
            $table->decimal('longitude')->comment('经度');
            $table->decimal('latitude')->comment('纬度');
            $table->string('area_code')->default('')->comment('行政区划代码');
            $table->string('is_default')->default('NO')->comment('是否默认地址');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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