function metatag_update_7015 in Metatag 7
Add the revision_id from the entity into metatag schema.
Also adjust the primary keys accordingly.
6 calls to metatag_update_7015()
- metatag_update_7009 in ./
metatag.install - Fix {metatag} records for taxonomy terms.
- metatag_update_7010 in ./
metatag.install - Fix {metatag} records for users.
- metatag_update_7011 in ./
metatag.install - Fix {metatag} records for nodes.
- metatag_update_7012 in ./
metatag.install - Remove duplicate {metatag} records for non-core entities.
- metatag_update_7013 in ./
metatag.install - Fix the {metatag} language value for all non-core entity records.
File
- ./
metatag.install, line 1556 - Install, update, and uninstall functions for the metatag module.
Code
function metatag_update_7015() {
if (!db_field_exists('metatag', 'revision_id')) {
// Leave a note for metatag_metatags_load_multiple() that the revision_id
// field has been added.
variable_set('metatag_has_revision_id', TRUE);
// Tell update 7017 that it isn't needed.
variable_set('metatag_skip_update_7017', TRUE);
// Add the new field.
db_add_field('metatag', 'revision_id', array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The revision_id for the entity object this data is attached to.',
));
// Remove the existing primary key. This may take some work so it can be
// database agnostic, i.e. some databases will not like it.
db_drop_primary_key('metatag');
// Add the new primary key.
db_add_primary_key('metatag', array(
'entity_type',
'entity_id',
'revision_id',
'language',
));
drupal_set_message(t('Added the {metatag}.revision_id field.'));
}
else {
drupal_set_message(t('The {metatag}.revision_id field has already been added, nothing to do.'));
}
}