diff --git a/core/modules/history/history.install b/core/modules/history/history.install index 782ba03..a6e7fb8 100644 --- a/core/modules/history/history.install +++ b/core/modules/history/history.install @@ -53,46 +53,3 @@ function history_schema() { return $schema; } - -/** - * Implements hook_update_dependencies(). - */ -function history_update_dependencies() { - // Convert after *id fields unsigned. - $dependencies['history'][8000] = array( - 'node' => 8005, - ); -} - -/** - * Upgrades {history} to be used for any entity type. - */ -function history_update_8000() { - // Drop all keys to properly rename constraints. - db_drop_primary_key('history'); - db_drop_index('history', 'nid'); - // Add new column. - db_add_field('history', 'entity_type', array( - 'type' => 'varchar', - 'not null' => TRUE, - 'default' => 'node', - 'length' => 255, - 'description' => 'The entity_type of the entity was read.', - )); - db_change_field('history', 'nid', 'entity_id', array( - 'description' => 'The entity_id that was read.', - 'type' => 'int', - 'not null' => TRUE, - 'default' => 0, - )); - // Create new indexes. - db_add_primary_key('history', array( - 'uid', - 'entity_id', - array('entity_type', 32), - )); - db_add_index('history', 'history_entity', array( - 'entity_id', - array('entity_type', 32), - )); -} diff --git a/core/modules/node/node.install b/core/modules/node/node.install index 0e755b5..485c876 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -683,9 +683,37 @@ function node_update_8011() { } /** - * Enable History module. + * Convert {history} table to new format and enable History module. */ function node_update_8012() { + // Drop all keys to properly rename constraints. + db_drop_primary_key('history'); + db_drop_index('history', 'nid'); + // Add new column. + db_add_field('history', 'entity_type', array( + 'type' => 'varchar', + 'not null' => TRUE, + 'default' => 'node', + 'length' => 255, + 'description' => 'The entity_type of the entity was read.', + )); + db_change_field('history', 'nid', 'entity_id', array( + 'description' => 'The entity_id that was read.', + 'type' => 'int', + 'not null' => TRUE, + 'default' => 0, + )); + // Create new indexes. + db_add_primary_key('history', array( + 'uid', + 'entity_id', + array('entity_type', 32), + )); + db_add_index('history', 'history_entity', array( + 'entity_id', + array('entity_type', 32), + )); + // Enable the history module without re-installing the schema. update_module_enable(array('history')); }