diff --git a/core/modules/history/history.install b/core/modules/history/history.install index 086c8f7..d38b907 100644 --- a/core/modules/history/history.install +++ b/core/modules/history/history.install @@ -13,7 +13,7 @@ function history_schema() { 'description' => 'A record of which {users} have read which {node}s.', 'fields' => array( 'uid' => array( - 'description' => 'The {users}.uid that read the entity_id.', + 'description' => 'The {users}.uid that read the {history}.entity_id entity.', 'type' => 'int', 'not null' => TRUE, 'default' => 0, @@ -21,15 +21,13 @@ function history_schema() { 'entity_type' => array( 'type' => 'varchar', 'not null' => TRUE, - 'default' => 'node', 'length' => 255, - 'description' => 'The entity_type of the entity was read.', + 'description' => 'The type of the entity that was read.', ), 'entity_id' => array( - 'description' => 'The entity_id that was read.', + 'description' => 'The ID of the entity that was read.', 'type' => 'int', 'not null' => TRUE, - 'default' => 0, ), 'timestamp' => array( 'description' => 'The Unix timestamp at which the read occurred.', diff --git a/core/modules/node/node.install b/core/modules/node/node.install index fceaa3b..e269f5d 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -723,22 +723,30 @@ function node_update_8011() { * Convert {history} table to new format and enable History module. */ function node_update_8012() { + // @todo replace with proper migrate implementation. // Drop all keys to properly rename constraints. db_drop_primary_key('history'); db_drop_index('history', 'nid'); - // Add new column. + // Add new column and fill with 'node' entity type. 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.', + 'description' => 'The type of the entity that was read.', )); + // Remove default value. + db_change_field('history', 'entity_type', 'entity_type', array( + 'type' => 'varchar', + 'not null' => TRUE, + 'length' => 255, + 'description' => 'The type of the entity that was read.', + )); + // Rename the field. db_change_field('history', 'nid', 'entity_id', array( - 'description' => 'The entity_id that was read.', + 'description' => 'The ID of the entity that was read.', 'type' => 'int', 'not null' => TRUE, - 'default' => 0, )); // Create new indexes. db_add_primary_key('history', array(