wzq 5 years ago
parent
commit
7db5acd411

+ 7 - 5
database/migrations/2019_07_29_102107_add_index_to_table_feed.php

@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Migrations\Migration;
 
 
-class AddIndexToTableFeed extends Migration
+class AddIndexToTableFeeds extends Migration
 {
 {
     /**
     /**
      * Run the migrations.
      * Run the migrations.
@@ -13,9 +13,11 @@ class AddIndexToTableFeed extends Migration
      */
      */
     public function up()
     public function up()
     {
     {
-        Schema::table('feed', function (Blueprint $table) {
-            $table->index(['uid', 'follow_uid', 'type', 'relate_id'],'idx_search');
-        });
+        for($i = 0; $i < 10; $i++){
+            Schema::table('feed_'.$i, function (Blueprint $table) {
+                $table->index(['uid', 'follow_uid', 'type', 'relate_id'],'idx_search');
+            });
+        }
     }
     }
 
 
     /**
     /**
@@ -25,7 +27,7 @@ class AddIndexToTableFeed extends Migration
      */
      */
     public function down()
     public function down()
     {
     {
-        Schema::table('feed', function (Blueprint $table) {
+        Schema::table('table_feeds', function (Blueprint $table) {
             //
             //
         });
         });
     }
     }