video_embed_field.install in Video Embed Field 7
File
video_embed_field.install
View source
<?php
function video_embed_field_field_schema($field) {
switch ($field['type']) {
case 'video_embed_field':
$columns = array(
'video_url' => array(
'type' => 'varchar',
'length' => 512,
'default' => '',
),
'embed_code' => array(
'type' => 'varchar',
'length' => 1024,
'default' => '',
),
'description' => array(
'type' => 'text',
'not null' => FALSE,
),
);
$indexes = array();
break;
}
return array(
'columns' => $columns,
'indexes' => $indexes,
);
}
function video_embed_field_uninstall() {
}
function video_embed_field_update_7000() {
$video_embed_fields = array();
foreach (field_info_fields() as $field_name => $field_info) {
if ($field_info['type'] == 'video_embed_field') {
$video_embed_fields[$field_name] = field_read_field($field_name);
}
}
foreach ($video_embed_fields as $field) {
if ($field['deleted']) {
$table = "field_deleted_data_{$field['id']}";
$revision_table = "field_deleted_revision_{$field['id']}";
}
else {
$table = "field_data_{$field['field_name']}";
$revision_table = "field_revision_{$field['field_name']}";
}
$column = $field['field_name'] . '_' . 'description';
db_add_field($table, $column, array(
'type' => 'text',
'not null' => FALSE,
));
db_add_field($revision_table, $column, array(
'type' => 'text',
'not null' => FALSE,
));
}
return t('Additional columns added.');
}