mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Added indexes for speed
This commit is contained in:
parent
1f299ed73e
commit
05e3e6bda6
39
database/migrations/2018_05_14_215229_add_indexes.php
Normal file
39
database/migrations/2018_05_14_215229_add_indexes.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddIndexes extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('action_logs', function (Blueprint $table) {
|
||||||
|
$table->index(['target_id', 'target_type']);
|
||||||
|
$table->index('created_at');
|
||||||
|
$table->index(['item_type', 'item_id', 'action_type']);
|
||||||
|
$table->index(['target_type', 'target_id', 'action_type']);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('action_logs', function (Blueprint $table) {
|
||||||
|
$table->dropIndex(['target_id', 'target_type']);
|
||||||
|
$table->dropIndex(['created_at']);
|
||||||
|
$table->dropIndex(['item_type', 'item_id', 'action_type']);
|
||||||
|
$table->dropIndex(['target_type', 'target_id', 'action_type']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddIndexesToAssets extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('assets', function (Blueprint $table) {
|
||||||
|
$table->index('created_at');
|
||||||
|
$table->index(['deleted_at', 'status_id']);
|
||||||
|
$table->index(['deleted_at', 'model_id']);
|
||||||
|
$table->index(['deleted_at', 'assigned_type', 'assigned_to']);
|
||||||
|
$table->index(['deleted_at', 'supplier_id']);
|
||||||
|
$table->index(['deleted_at', 'location_id']);
|
||||||
|
$table->index(['deleted_at', 'rtd_location_id']);
|
||||||
|
$table->index(['deleted_at', 'asset_tag']);
|
||||||
|
$table->index(['deleted_at', 'name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('assets', function (Blueprint $table) {
|
||||||
|
$table->dropIndex(['created_at']);
|
||||||
|
$table->dropIndex(['deleted_at', 'status_id']);
|
||||||
|
$table->dropIndex(['deleted_at', 'model_id']);
|
||||||
|
$table->dropIndex(['deleted_at', 'assigned_type', 'assigned_to']);
|
||||||
|
$table->dropIndex(['deleted_at', 'supplier_id']);
|
||||||
|
$table->dropIndex(['deleted_at', 'location_id']);
|
||||||
|
$table->dropIndex(['deleted_at', 'rtd_location_id']);
|
||||||
|
$table->dropIndex(['deleted_at', 'asset_tag']);
|
||||||
|
$table->dropIndex(['deleted_at', 'name']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue