function workflow_update_7003 in Workflow 7.2
Same name and namespace in other branches
- 7 workflow.install \workflow_update_7003()
Add Entity field capabilities to workflow_scheduled_transition table.
File
- ./
workflow.install, line 545 - Install, update and uninstall functions for the workflow module.
Code
function workflow_update_7003() {
$field = array(
'description' => 'The type of entity this transition belongs to.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
);
if (!db_field_exists('workflow_scheduled_transition', 'entity_type')) {
db_add_field('workflow_scheduled_transition', 'entity_type', $field);
}
if (!db_field_exists('workflow_node_history', 'entity_type')) {
db_add_field('workflow_node_history', 'entity_type', $field);
}
$field = array(
'description' => 'The name of the field the transition relates to.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
);
if (!db_field_exists('workflow_scheduled_transition', 'field_name')) {
db_add_field('workflow_scheduled_transition', 'field_name', $field);
}
if (!db_field_exists('workflow_node_history', 'field_name')) {
db_add_field('workflow_node_history', 'field_name', $field);
}
$field = array(
'description' => 'The {languages}.language of the entity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
);
if (!db_field_exists('workflow_scheduled_transition', 'language')) {
db_add_field('workflow_scheduled_transition', 'language', $field);
}
if (!db_field_exists('workflow_node_history', 'language')) {
db_add_field('workflow_node_history', 'language', $field);
}
$field = array(
'description' => 'The sequence number for this data item, used for multi-value fields',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
);
if (!db_field_exists('workflow_scheduled_transition', 'delta')) {
db_add_field('workflow_scheduled_transition', 'delta', $field);
}
if (!db_field_exists('workflow_node_history', 'delta')) {
db_add_field('workflow_node_history', 'delta', $field);
}
db_drop_index('workflow_scheduled_transition', 'nid');
db_drop_index('workflow_scheduled_transition', 'entity_id');
db_drop_index('workflow_scheduled_transition', 'entity_type');
db_add_index('workflow_scheduled_transition', 'entity_id', array(
'entity_type',
'nid',
));
db_add_index('workflow_scheduled_transition', 'entity_type', array(
'entity_type',
));
db_drop_index('workflow_node_history', 'nid');
db_drop_index('workflow_node_history', 'sid');
db_add_index('workflow_node_history', 'sid', array(
'entity_type',
'nid',
'sid',
));
}