Skip to content

Commit

Permalink
#2534 Updated indices which should make route popularity a bunch quic…
Browse files Browse the repository at this point in the history
…ker. In theory.
  • Loading branch information
Wotuu committed Oct 2, 2024
1 parent da97072 commit 66ef99e
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('page_views', function (Blueprint $table) {
$table->dropIndex('page_views_model_class_index');

$table->index(['model_class', 'created_at', 'model_id'], 'page_views_popularity_index');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('page_views', function (Blueprint $table) {
$table->dropIndex('page_views_popularity_index');

$table->index(['model_class']);
});
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('dungeon_routes', function (Blueprint $table) {
$table->index(['published_state_id', 'clone_of']);
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('dungeon_routes', function (Blueprint $table) {
$table->dropIndex(['published_state_id', 'clone_of']);
});
}
};

0 comments on commit 66ef99e

Please sign in to comment.