Issue #476304 by Liam Morland: fixed mismatch of schema definition of uid, nid.

8.0.x
Dries 2012-10-04 16:27:03 -04:00
parent f0da6c528d
commit 84c6fea4be
6 changed files with 187 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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'))
);
}

View File

@ -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.

View File

@ -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".
*/