浏览代码

修改省市区表的字段 增加新字段

duqinya 6 年之前
父节点
当前提交
ad821f4f8c

+ 35 - 0
database/migrations/2019_04_25_120244_add_bjcity_id_config_province_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBjcityIdConfigProvinceTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->renameColumn('name', 'area_name');
+            $table->string('area_code',50)->nullable()->comment('地区编码');
+            $table->string('city_code',50)->comment('城市编码');
+            $table->string('center',50)->comment('城市中心点(即:经纬度坐标)');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->dropColumn('area_name','area_code','city_code','center');
+        });
+    }
+}

+ 32 - 0
database/migrations/2019_04_25_143155_add_bjcity_config_province_table.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddBjcityConfigProvinceTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->renameColumn('id', 'bjcity_id',20)->comment('地区id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('config_province', function (Blueprint $table) {
+            $table->dropColumn('bjcity_id');
+        });
+    }
+}