2020_05_30_203523_create_base_district_table.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. use Illuminate\Support\Facades\Schema;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Database\Migrations\Migration;
  5. class CreateBaseDistrictTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('base_district', function (Blueprint $table) {
  15. $table->integer('id')->comment('编号');
  16. $table->char('name', 50)->comment('名称');
  17. $table->integer('pid')->comment('父级');
  18. $table->char('short_name', 50)->comment('简称');
  19. $table->tinyInteger('grade')->comment('层级关系');
  20. $table->smallInteger('city_code')->comment('区号');
  21. $table->integer('zip_code')->comment('邮编');
  22. $table->string('merger_name', 1024)->comment('关系值');
  23. $table->float('lng')->comment('精度');
  24. $table->float('lat')->comment('维度');
  25. $table->char('pinyin', 50)->comment('拼音');
  26. $table->timestamps();
  27. $table->softDeletes();
  28. $table->primary('id');
  29. $table->index('pid', 'idx_pid');
  30. $table->index('deleted_at', 'idx_deleted_at');
  31. });
  32. }
  33. /**
  34. * Reverse the migrations.
  35. *
  36. * @return void
  37. */
  38. public function down()
  39. {
  40. Schema::dropIfExists('base_district');
  41. }
  42. }