]> BookStack Code Mirror - bookstack/commitdiff
Add index for user IP address
authorZero <redacted>
Fri, 26 Nov 2021 07:10:39 +0000 (15:10 +0800)
committerZero <redacted>
Fri, 10 Dec 2021 06:50:04 +0000 (14:50 +0800)
database/migrations/2021_11_26_070438_add_index_for_user_ip.php [new file with mode: 0644]

diff --git a/database/migrations/2021_11_26_070438_add_index_for_user_ip.php b/database/migrations/2021_11_26_070438_add_index_for_user_ip.php
new file mode 100644 (file)
index 0000000..c4681a9
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddIndexForUserIp extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('activities', function (Blueprint $table) {
+            $table->index('ip', 'ip_address_index');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('activities', function (Blueprint $table) {
+            $table->dropIndex('ip_address_index');
+        });
+    }
+}