Skip to content

NOW MANAGED ON CODEBERG

Add index for user IP address

Zeroa93254430c3a
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
index 000000000..c4681a9a3
--- /dev/null
+++ b/database/migrations/2021_11_26_070438_add_index_for_user_ip.php
@@ -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');
+ });
+ }
+}