summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries2012-10-04 20:27:03 (GMT)
committerDries2012-10-04 20:27:03 (GMT)
commit84c6fea4be6317842911ab84c64a54d94d658cb3 (patch)
tree435d8bd89eb3f64607488b2e40c0ab1c37a320fb
parentf0da6c528d46d869cec8f1a54572123ce070e713 (diff)
Issue #476304 by Liam Morland: fixed mismatch of schema definition of uid, nid.
-rw-r--r--core/modules/comment/comment.install51
-rw-r--r--core/modules/dblog/dblog.install20
-rw-r--r--core/modules/node/node.install61
-rw-r--r--core/modules/statistics/statistics.install18
-rw-r--r--core/modules/tracker/tracker.install21
-rw-r--r--core/modules/user/user.install16
6 files changed, 187 insertions, 0 deletions
diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install
index 0a147b5..6692a95 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.',
@@ -317,6 +320,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 919bab3..398171a 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.',
@@ -107,6 +108,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 eb9094b..ac777f3 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,
),
@@ -603,6 +607,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 97c5518..c0d0a6f 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 64dd8c4..569f488 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,
),
@@ -132,6 +133,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 9d7a4af..422dcfb 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.",
@@ -568,5 +569,20 @@ 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".
*/