diff --git a/src/Utility/Migrations/2024_08_20_163744_add_indexes_for_url_tracing.php b/src/Utility/Migrations/2024_08_20_163744_add_indexes_for_url_tracing.php index 2754e24..11d7977 100644 --- a/src/Utility/Migrations/2024_08_20_163744_add_indexes_for_url_tracing.php +++ b/src/Utility/Migrations/2024_08_20_163744_add_indexes_for_url_tracing.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; return new class extends Migration @@ -14,7 +15,13 @@ public function up() { Schema::table('short_url_tracings', function (Blueprint $table) { - $table->index(['utm_source(100)', 'utm_medium(100)', 'utm_campaign(100)', 'utm_content(100)', 'utm_term(100)'], 'utm_composite_index'); + DB::statement('CREATE INDEX utm_composite_index ON short_url_tracings (utm_source(100), utm_medium(100), utm_campaign(100), utm_content(100), utm_term(100))'); + }); + } + + public function down(){ + Schema::table('short_url_tracings', function (Blueprint $table) { + $table->dropIndex('utm_composite_index'); }); } };