summaryrefslogtreecommitdiff
path: root/modules/comment/comment.install
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-10-10 13:37:11 +0000
committerDries Buytaert <dries@buytaert.net>2009-10-10 13:37:11 +0000
commit15b24127b5abb1c66fb5a7579a07e00b571174b0 (patch)
tree0fb8cddc92f3a86c65d40a4be58d5dbcb43a020a /modules/comment/comment.install
parentdb53d99659801c539f1fa813af38bf65803ab8f2 (diff)
downloadbrdo-15b24127b5abb1c66fb5a7579a07e00b571174b0.tar.gz
brdo-15b24127b5abb1c66fb5a7579a07e00b571174b0.tar.bz2
- Patch #122098 by Damien Tournoud, catch, mdixoncm: split comment.timestamp into 'created' and 'changed' columns, just like for nodes.
Diffstat (limited to 'modules/comment/comment.install')
-rw-r--r--modules/comment/comment.install43
1 files changed, 39 insertions, 4 deletions
diff --git a/modules/comment/comment.install b/modules/comment/comment.install
index 300534544..c5d78e1b3 100644
--- a/modules/comment/comment.install
+++ b/modules/comment/comment.install
@@ -130,6 +130,35 @@ function comment_update_7006() {
}
/**
+ * Split {comment}.timestamp into {comment}.created and {comment}.changed.
+ */
+function comment_update_7007() {
+ // Drop the index associated to timestamp.
+ db_drop_index('comment', 'comment_num_new');
+
+ // Create a created column.
+ db_add_field('comment', 'created', array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ ));
+
+ // Rename the timestamp column to changed.
+ db_change_field('comment', 'timestamp', 'changed', array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ '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');
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
@@ -184,11 +213,17 @@ function comment_schema() {
'default' => '',
'description' => "The author's host name.",
),
- 'timestamp' => array(
+ 'created' => array(
+ 'type' => 'int',
+ 'not null' => TRUE,
+ 'default' => 0,
+ 'description' => 'The time that the comment was created, as a Unix timestamp.',
+ ),
+ 'changed' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
- 'description' => 'The time that the comment was created, or last edited by its author, as a Unix timestamp.',
+ 'description' => 'The time that the comment was last edited, as a Unix timestamp.',
),
'status' => array(
'type' => 'int',
@@ -232,7 +267,7 @@ function comment_schema() {
),
'indexes' => array(
'comment_status_pid' => array('pid', 'status'),
- 'comment_num_new' => array('nid', 'timestamp', 'status'),
+ 'comment_num_new' => array('nid', 'changed', 'status'),
'comment_uid' => array('uid'),
),
'primary key' => array('cid'),
@@ -291,4 +326,4 @@ function comment_schema() {
);
return $schema;
-} \ No newline at end of file
+}