38 lines
927 B
PHP
38 lines
927 B
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
class CreateZonesTable extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('zones', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->unsignedBigInteger('parent_id')->nullable()->comment('父级 ID');
|
|
$table->string('name')->comment('省/市/区 名称');
|
|
$table->enum('type', ['province', 'city', 'area'])->comment('类型');
|
|
$table->timestamps();
|
|
});
|
|
|
|
DB::unprepared(file_get_contents(base_path('database/sql/zones.sql')));
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('zones');
|
|
}
|
|
}
|