Test Setup Failed
Push — master ( ad0913...368932 )
by Dennis
14:58
created

anonymous//database/migrations/2024_07_26_173507_create_regions_table.php$0   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 17
c 1
b 0
f 0
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A 2024_07_26_173507_create_regions_table.php$0 ➔ down() 0 3 1
A 2024_07_26_173507_create_regions_table.php$0 ➔ up() 0 17 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
return new class extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     */
12
    public function up(): void
13
    {
14
        Schema::create('regions', function (Blueprint $table) {
15
            $table->id();
16
            $table->string('name')->comment('社区名称');
17
            $table->string('city_code')->comment("城市代码");
18
            $table->string('city')->comment("城市名称");
19
            $table->string('province_code')->comment("省份名称");
20
            $table->string('province')->comment("省份名称");
21
            $table->string('county_code')->comment("县区名称");
22
            $table->string('county')->comment("县区名称");
23
            $table->string('address')->comment("地址");
24
            $table->geography('geo', subtype: 'point')->comment("地理信息");
25
            $table->string('model_id')->index()->nullable()->comment("模型ID");
26
            $table->string('model_type')->index()->nullable()->comment('关联类');
27
            $table->timestamps();
28
            $table->comment("地理信息储存表");
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     */
35
    public function down(): void
36
    {
37
        Schema::dropIfExists('regions');
38
    }
39
};
40