function nodequeue_update_7200 in Nodequeue 7.2
Same name and namespace in other branches
- 7.3 nodequeue.install \nodequeue_update_7200()
Renaming indices so that they're consistent with what Schema module would expect.
File
- ./
nodequeue.install, line 327 - Install, update and uninstall functions for the nodequeue module.
Code
function nodequeue_update_7200() {
// Check if the indices weren't already renamed by a 6.x-2.x-dev version
// prior to 6.x-2.10.
if (!db_index_exists('nodequeue_nodes', 'sqid')) {
// Delete existing indexes
$del_indices = array(
'nodequeue_roles' => array(
'qid',
'rid',
),
'nodequeue_types' => array(
'qid',
'type',
),
'nodequeue_subqueue' => array(
'qid',
'reference',
'title',
),
'nodequeue_nodes' => array(
'sqid',
'qid_nid',
),
);
foreach ($del_indices as $table => $indices) {
foreach ($indices as $k => $index) {
db_drop_index($table, $table . "_" . $index . "_idx");
}
}
// Naming convention incorrect for this one
db_drop_index("nodequeue_nodes", "nodequeue_subqueue_nid_idx");
// Create new indexes
$add_indexes = array(
'nodequeue_roles' => array(
'qid' => array(
'qid',
),
'rid' => array(
'rid',
),
),
'nodequeue_types' => array(
'qid' => array(
'qid',
),
'type' => array(
'type',
),
),
'nodequeue_subqueue' => array(
'qid' => array(
'qid',
),
'reference' => array(
'reference',
),
'title' => array(
'title',
),
),
'nodequeue_nodes' => array(
'sqid' => array(
'sqid',
'position',
),
'qid_nid' => array(
'qid',
'nid',
),
'nid' => array(
'nid',
),
),
);
foreach ($add_indexes as $table => $indices) {
foreach ($indices as $name => $columns) {
db_add_index($table, $name, $columns);
}
}
}
}