function twitter_update_6004 in Twitter 6.5
Same name and namespace in other branches
- 6.2 twitter.install \twitter_update_6004()
- 6.3 twitter.install \twitter_update_6004()
- 6.4 twitter.install \twitter_update_6004()
Add NOT NULL constraint and DEFAULT value to the screen_name field of the twitter and twitter_user tables per updated schema definition.
See also
https://www.drupal.org/node/336048
https://www.drupal.org/node/430442
File
- ./
twitter.install, line 462 - Install, update and uninstall functions for the twitter module.
Code
function twitter_update_6004() {
$ret = array();
// Have to drop PRIMARY KEY and indexes that use the field being changed.
// twitter
db_drop_index($ret, 'twitter', 'screen_name');
db_change_field($ret, 'twitter', 'screen_name', 'screen_name', array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
), array(
'indexes' => array(
'screen_name' => array(
'screen_name',
),
),
));
// twitter_user
db_drop_index($ret, 'twitter_user', 'screen_name');
db_drop_primary_key($ret, 'twitter_user');
db_change_field($ret, 'twitter_user', 'screen_name', 'screen_name', array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
), array(
'primary key' => array(
'uid',
'screen_name',
),
'indexes' => array(
'screen_name' => array(
'screen_name',
),
),
));
return $ret;
}