<?php
$_db_migration_to = '40.26'; // 9.2.1
if (!isset($migrations) || !is_object($migrations))
	die("This file cannot be executed directly");
$migrations->CheckValid($_db_migration_to);
//===========================================================================================



$migrations->Run('20240614_ic_hd_issues_indexes_reimplementation.php', <<<'DB_UPDATE_FILE'
<?php

/**
 * BT-4654 IC/IC Dashboard slowness on the client server.
 *
 * Re-implementation of the same migration from 8.13
 *
 * @var \Claromentis\Setup\SetupFacade $migrations
 */
$db = $migrations->GetDb();

// The index should be applied to the method `ICIssuesListProvider::GetListQuery()`. I suspect the query is getting slower during
// use Advance search form in issues list. Adding those index should improve that performance.
// However, the filter can be different depend of the user, probably more index should be applied for all columns.
$db->CreateIndex('hd_issue', 'idx_assigned_status_project_id', 'assigned', 'status', 'project_id');

DB_UPDATE_FILE
);


//===========================================================================================
$migrations->SetVersion('40.26');
