فهرست منبع

Add new migration, add index to likes table

Daniel Supernault 4 سال پیش
والد
کامیت
77bb2299bd
1فایلهای تغییر یافته به همراه34 افزوده شده و 0 حذف شده
  1. 34 0
      database/migrations/2020_12_01_073200_add_indexes_to_likes_table.php

+ 34 - 0
database/migrations/2020_12_01_073200_add_indexes_to_likes_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddIndexesToLikesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('likes', function (Blueprint $table) {
+            $table->index('profile_id', 'likes_profile_id_index');
+            $table->index('status_id', 'likes_status_id_index');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('likes', function (Blueprint $table) {
+            $table->dropIndex('likes_profile_id_index');
+            $table->dropIndex('likes_status_id_index');
+        });
+    }
+}