function twitter_post_update_7501 in Twitter 7.6
Add the missing 'status' field.
File
- twitter_post/
twitter_post.install, line 115 - Install, update and uninstall functions for the twitter module.
Code
function twitter_post_update_7501() {
// Get the list of fields.
$types = array(
'twitter_post',
);
$fields = array();
foreach (field_info_fields() as $field) {
if (in_array($field['type'], $types)) {
$fields[] = $field;
}
}
if (!empty($fields)) {
$spec = array(
'description' => 'Control whether or not this entity will be tweeted.',
'type' => 'int',
'length' => 1,
'not null' => TRUE,
'size' => 'tiny',
'default' => 0,
);
foreach ($fields as $field) {
$tables = array(
_field_sql_storage_tablename($field),
_field_sql_storage_revision_tablename($field),
);
foreach ($tables as $table) {
$column = $field['field_name'] . '_status';
if (db_field_exists($table, $column)) {
db_change_field($table, $column, $column, $spec);
}
else {
db_add_field($table, $column, $spec);
}
}
}
return t('Added the missing "account" field.');
}
}