Révision 59ae487e
Ajouté par Assos Assos il y a presque 7 ans
drupal7/sites/all/modules/entityreference/entityreference.install | ||
---|---|---|
165 | 165 |
} |
166 | 166 |
|
167 | 167 |
/** |
168 |
* Implements hook_update_N(). |
|
169 |
* |
|
168 | 170 |
* Remove duplicate rows in the taxonomy_index table. |
169 | 171 |
*/ |
170 | 172 |
function entityreference_update_7100() { |
171 | 173 |
if (db_table_exists('taxonomy_index')) { |
174 |
if (db_table_exists('taxonomy_index_tmp')) { |
|
175 |
db_drop_table('taxonomy_index_tmp'); |
|
176 |
} |
|
177 |
|
|
172 | 178 |
$tx_schema = drupal_get_schema('taxonomy_index'); |
173 | 179 |
db_create_table('taxonomy_index_tmp', $tx_schema); |
174 | 180 |
$select = db_select('taxonomy_index', 'tx'); |
175 |
$select->fields('tx'); |
|
181 |
$select->fields('tx', array('nid', 'tid'));
|
|
176 | 182 |
$select->groupBy('tx.nid'); |
177 | 183 |
$select->groupBy('tx.tid'); |
184 |
$select->addExpression('MAX(sticky)', 'sticky'); |
|
185 |
$select->addExpression('MAX(created)', 'created'); |
|
178 | 186 |
db_insert('taxonomy_index_tmp')->from($select)->execute(); |
179 | 187 |
db_drop_table('taxonomy_index'); |
180 | 188 |
db_rename_table('taxonomy_index_tmp', 'taxonomy_index'); |
Formats disponibles : Unified diff
Weekly update of contrib modules