Skip to content
Snippets Groups Projects
Commit 29dc1d64 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #734750 by Damien Tournoud: unnecessary belly-dancing about indexes on {comment}.

parent 58e98669
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -139,16 +139,6 @@ function comment_update_7002() {
db_rename_table('comments', 'comment');
}
/**
* Improve indexes on the comment table.
*/
function comment_update_7003() {
db_drop_index('comment', 'status');
db_drop_index('comment', 'pid');
db_add_index('comment', 'comment_pid_status', array('pid', 'status'));
db_add_index('comment', 'comment_num_new', array('nid', 'timestamp', 'status'));
}
/**
* Rename comment display setting variables.
*/
......@@ -183,11 +173,12 @@ function comment_update_7006() {
}
/**
* Split {comment}.timestamp into {comment}.created and {comment}.changed.
* Split {comment}.timestamp into 'created' and 'changed', improve indexing on {comment}.
*/
function comment_update_7007() {
// Drop the index associated to timestamp.
db_drop_index('comment', 'comment_num_new');
// Drop the old indexes.
db_drop_index('comment', 'status');
db_drop_index('comment', 'pid');
// Create a created column.
db_add_field('comment', 'created', array(
......@@ -203,12 +194,15 @@ function comment_update_7007() {
'default' => 0,
));
// Recreate the index.
db_add_index('comment', 'comment_num_new', array('nid', 'changed', 'status'));
// Migrate the data.
// @todo db_update() should support this.
db_query('UPDATE {comment} SET created = changed');
// Recreate the indexes.
// The 'comment_num_new' index is optimized for comment_num_new()
// and comment_new_page_count().
db_add_index('comment', 'comment_num_new', array('nid', 'status', 'created', 'cid', 'thread'));
db_add_index('comment', 'comment_pid_status', array('pid', 'status'));
}
/**
......@@ -351,14 +345,6 @@ function comment_update_7013(&$sandbox) {
}
}
/**
* Optimize index for comment_num_new() and comment_new_page_count().
*/
function comment_update_7014() {
db_drop_index('comment', 'comment_num_new');
db_add_index('comment', 'comment_num_new', array('nid', 'status', 'created', 'cid', 'thread'));
}
/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment