/** * Detect if no clustered index has been created for a table; if none created then just pick the first index and make it that * * @see MssqlHelper::indexSQL() */ public function indexSQL($tableName, $fieldDefs, $indices) { if ($this->doesTableHaveAClusteredIndexDefined($tableName)) { return parent::indexSQL($tableName, $fieldDefs, $indices); } // check to see if one of the passed in indices is a primary one; if so we can bail as well foreach ($indices as $index) { if ($index['type'] == 'primary') { return parent::indexSQL($tableName, $fieldDefs, $indices); } } // Change the first index listed to be a clustered one instead ( so we have at least one for the table ) if (isset($indices[0])) { $indices[0]['type'] = 'clustered'; } return parent::indexSQL($tableName, $fieldDefs, $indices); }