diff --git a/database/migrations/2018_05_14_215229_add_indexes.php b/database/migrations/2018_05_14_215229_add_indexes.php new file mode 100644 index 0000000000..4f917f74e2 --- /dev/null +++ b/database/migrations/2018_05_14_215229_add_indexes.php @@ -0,0 +1,39 @@ +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']); + }); + } +} diff --git a/database/migrations/2018_05_14_223646_add_indexes_to_assets.php b/database/migrations/2018_05_14_223646_add_indexes_to_assets.php new file mode 100644 index 0000000000..a7161bdb53 --- /dev/null +++ b/database/migrations/2018_05_14_223646_add_indexes_to_assets.php @@ -0,0 +1,48 @@ +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']); + }); + } +}