View source
<?php
function field_weight_field_collection_schema() {
$schema = array();
$schema['field_weight_field_collection'] = array(
'description' => 'Field collection instance weight table.',
'fields' => array(
'nid' => array(
'description' => 'The primary identifier for a node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'vid' => array(
'description' => 'The revision identifier for a node.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'type' => array(
'description' => 'The bundle type of this node.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
),
'field_weights' => array(
'description' => 'Serialised array of keyed array containing field_name_{$delta} => weight.',
'type' => 'blob',
'not null' => TRUE,
),
),
'unique keys' => array(
'nid_vid' => array(
'nid',
'vid',
),
'vid' => array(
'vid',
),
),
'primary key' => array(
'nid',
'vid',
),
);
return $schema;
}
function field_weight_field_collection_update_7101() {
$fwfc_table = drupal_get_schema_unprocessed('field_weight_field_collection', 'field_weight_field_collection');
db_create_table('field_weight_field_collection', $fwfc_table);
}
function field_weight_field_collection_update_7102() {
db_drop_primary_key('field_weight_field_collection');
db_add_primary_key('field_weight_field_collection', array(
'nid',
'vid',
));
}
function field_weight_field_collection_update_7201() {
if (!module_exists('field_weight_multiple')) {
module_enable(array(
'field_weight_multiple',
));
}
if (db_table_exists('field_weight_multiple')) {
db_drop_table('field_weight_multiple');
}
db_rename_table('field_weight_field_collection', 'field_weight_multiple');
module_disable(array(
'field_weight_field_collection',
));
return 'Field Collection Item Weights (field_weight_field_collection) has had its functionality merged into the new Multiple-Value Field Weights (field_weight_multiple) module; it is now deprecated. Your data has been moved to Field Weight Multiple, it has been enabled, and this module has been disabled. ';
}
function field_weight_field_collection_requirements($phase) {
$t = get_t();
switch ($phase) {
case 'install':
$requirement = array(
'field_weight_field_collection' => array(
'title' => $t('Field collection item weights is not migrated yet'),
'description' => $t('This module has been superseded by Multiple-Value Field Weights (field_weight_multiple) and will not be enabled.'),
'severity' => REQUIREMENT_ERROR,
),
);
if (module_exists('field_weight_field_collection') && (int) drupal_get_installed_schema_version('field_weight_field_collection') < 7201) {
return array();
}
return $requirement;
}
return array();
}