mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
27 lines
1,001 B
Plaintext
27 lines
1,001 B
Plaintext
<?php
|
|
/**
|
|
* @file
|
|
* Farm livestock install file.
|
|
*/
|
|
|
|
/**
|
|
* Migrate Animal Description field to plain Description field (from farm_fields).
|
|
*/
|
|
function farm_livestock_update_7000(&$sandbox) {
|
|
|
|
// Revert this module's field_instance Features component.
|
|
features_revert(array('farm_livestock' => array('field_instance')));
|
|
|
|
// If the new description field database tables exist...
|
|
if (db_table_exists('field_data_field_farm_description') && db_table_exists('field_revision_field_farm_description')) {
|
|
|
|
// Copy all descriptions from the old database tables to the new ones.
|
|
db_query('INSERT INTO {field_data_field_farm_description} SELECT * FROM {field_data_field_farm_animal_description}');
|
|
db_query('INSERT INTO {field_revision_field_farm_description} SELECT * FROM {field_revision_field_farm_animal_description}');
|
|
|
|
// Delete the old field.
|
|
$field = field_info_instance('farm_asset', 'field_farm_animal_description', 'animal');
|
|
field_delete_instance($field);
|
|
}
|
|
}
|