IndexManager.php in Drupal driver for SQL Server and SQL Azure 8
File
src/Indexes/IndexManager.php
View source
<?php
namespace Drupal\sqlsrv\Indexes;
use Drupal\Driver\Database\sqlsrv\Connection;
class IndexManager {
private $connection;
public function __construct(Connection $connection) {
$this->connection = $connection;
}
public function DeployNew() {
$dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Implementations';
$files = file_scan_directory($dir, '/.*\\.sql$/');
foreach ($files as $file) {
$index = new Index($file->uri);
$schema = $this->connection
->schema();
if (!$schema
->_ExistsIndex($index
->GetTable(), $index
->GetName())) {
try {
$this->connection
->query($index
->GetCode());
} catch (\Exception $e) {
\Drupal::logger('MSSQL')
->notice("Could not deploy index {$index->GetName()} for table {$index->GetTable()}");
}
}
}
}
}
Classes
Name |
Description |
IndexManager |
Default indexes to be deployed for CORE functionality. |