diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index 0a147b5d8e9..6692a954d4d 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -105,12 +105,14 @@ function comment_schema() { ), 'nid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The {node}.nid to which this comment is a reply.', ), 'uid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.', @@ -234,6 +236,7 @@ function comment_schema() { ), 'last_comment_uid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The user ID of the latest author to post a comment on this node, from {comment}.uid.', @@ -316,6 +319,54 @@ function comment_update_8001() { } } +/** + * Make *id fields unsigned. + */ +function comment_update_8002() { + db_drop_index('comment', 'comment_num_new'); + db_drop_index('comment', 'comment_nid_langcode'); + db_change_field('comment', 'nid', 'nid', + array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {node}.nid to which this comment is a reply.', + ), + array('indexes' => array( + 'comment_num_new' => array('nid', 'status', 'created', 'cid', 'thread'), + 'comment_nid_langcode' => array('nid', 'langcode'), + )) + ); + db_drop_index('comment', 'comment_uid'); + db_change_field('comment', 'uid', 'uid', + array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {users}.uid who authored the comment. If set to 0, this comment was created by an anonymous user.', + ), + array('indexes' => array( + 'comment_uid' => array('uid'), + )) + ); + + db_drop_index('node_comment_statistics', 'last_comment_uid'); + db_change_field('node_comment_statistics', 'last_comment_uid', 'last_comment_uid', + array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The user ID of the latest author to post a comment on this node, from {comment}.uid.', + ), + array('indexes' => array( + 'last_comment_uid' => array('last_comment_uid'), + )) + ); +} + /** * @} End of "addtogroup updates-7.x-to-8.x". * The next series of updates should start at 9000. diff --git a/core/modules/dblog/dblog.install b/core/modules/dblog/dblog.install index 919bab3884e..398171ae562 100644 --- a/core/modules/dblog/dblog.install +++ b/core/modules/dblog/dblog.install @@ -19,6 +19,7 @@ function dblog_schema() { ), 'uid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => 'The {users}.uid of the user who triggered the event.', @@ -106,6 +107,25 @@ function dblog_update_8000() { )); } +/** + * Make *id fields unsigned. + */ +function dblog_update_8001() { + db_drop_index('watchdog', 'uid'); + db_change_field('watchdog', 'uid', 'uid', + array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => 'The {users}.uid of the user who triggered the event.', + ), + array('indexes' => array( + 'uid' => array('uid'), + )) + ); +} + /** * @} End of "defgroup updates-7.x-to-8.x" * The next series of updates should start at 9000. diff --git a/core/modules/node/node.install b/core/modules/node/node.install index eb9094b3653..ac777f3f442 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -57,6 +57,7 @@ function node_schema() { 'uid' => array( 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), @@ -215,6 +216,7 @@ function node_schema() { 'uid' => array( 'description' => 'The {users}.uid that created this version.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), @@ -410,12 +412,14 @@ function node_schema() { 'uid' => array( 'description' => 'The {users}.uid that read the {node} nid.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'nid' => array( 'description' => 'The {node}.nid that was read.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), @@ -602,6 +606,63 @@ function node_update_8004() { } } +/** + * Make *id fields unsigned. + */ +function node_update_8005() { + db_drop_index('node', 'uid'); + db_change_field('node', 'uid', 'uid', + array( + 'description' => 'The {users}.uid that owns this node; initially, this is the user that created it.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + array('indexes' => array( + 'uid' => array('uid'), + )) + ); + + db_drop_index('node_revision', 'uid'); + db_change_field('node_revision', 'uid', 'uid', + array( + 'description' => 'The {users}.uid that created this version.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + array('indexes' => array( + 'uid' => array('uid'), + )) + ); + + db_drop_primary_key('history'); + db_drop_index('history', 'nid'); + db_change_field('history', 'uid', 'uid', + array( + 'description' => 'The {users}.uid that read the {node} nid.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ) + ); + db_change_field('history', 'nid', 'nid', + array( + 'description' => 'The {node}.nid that was read.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + array('primary key' => array('uid', 'nid'), 'indexes' => array( + 'nid' => array('nid'), + )) + ); +} + /** * @} End of "addtogroup updates-7.x-to-8.x" * The next series of updates should start at 9000. diff --git a/core/modules/statistics/statistics.install b/core/modules/statistics/statistics.install index 97c55181800..c0d0a6fe80d 100644 --- a/core/modules/statistics/statistics.install +++ b/core/modules/statistics/statistics.install @@ -88,6 +88,7 @@ function statistics_schema() { 'nid' => array( 'description' => 'The {node}.nid for these statistics.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), @@ -136,3 +137,20 @@ function statistics_update_8000() { 'statistics_block_top_last_num' => 'block.popular.top_recent_limit', )); } + +/** + * Make *id fields unsigned. + */ +function statistics_update_8001() { + db_drop_primary_key('node_counter'); + db_change_field('node_counter', 'nid', 'nid', + array( + 'description' => 'The {node}.nid for these statistics.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + array('primary key' => array('nid')) + ); +} diff --git a/core/modules/tracker/tracker.install b/core/modules/tracker/tracker.install index 64dd8c42ee4..569f4889d47 100644 --- a/core/modules/tracker/tracker.install +++ b/core/modules/tracker/tracker.install @@ -79,6 +79,7 @@ function tracker_schema() { 'uid' => array( 'description' => 'The {users}.uid of the node author or commenter.', 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), @@ -131,6 +132,26 @@ function tracker_update_8000() { )); } +/** + * Make *id fields unsigned. + */ +function tracker_update_8001() { + db_drop_primary_key('tracker_user'); + db_drop_index('tracker_user', 'tracker'); + db_change_field('tracker_user', 'uid', 'uid', + array( + 'description' => 'The {users}.uid of the node author or commenter.', + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + ), + array('primary key' => array('nid', 'uid'), 'indexes' => array( + 'tracker' => array('uid', 'published', 'changed'), + )) + ); +} + /** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 9d7a4af637d..422dcfb247e 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -20,6 +20,7 @@ function user_schema() { ), 'uid' => array( 'type' => 'int', + 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'description' => "User's {users}.uid.", @@ -567,6 +568,21 @@ function user_update_8007() { )); } +/** + * Make *id fields unsigned. + */ +function user_update_8008() { + db_change_field('authmap', 'uid', 'uid', + array( + 'type' => 'int', + 'unsigned' => TRUE, + 'not null' => TRUE, + 'default' => 0, + 'description' => "User's {users}.uid.", + ) + ); +} + /** * @} End of "addtogroup updates-7.x-to-8.x". */