function media_flickr_update_6000 in Media: Flickr 6
Create the new tables required.
File
- ./
media_flickr.install, line 33 - Installation file for Media: Flickr.
Code
function media_flickr_update_6000() {
$schema['media_flickr'] = array(
'description' => t('Stores data for individual flickr images.'),
'fields' => array(
'code' => array(
'default' => '',
'description' => t('The flickr photo code.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'title' => array(
'default' => '',
'description' => t('The flickr title.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'owner' => array(
'default' => '',
'description' => t('The flickr photo owner.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'description' => array(
'default' => '',
'description' => t('The flickr photo description.'),
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
),
'url' => array(
'default' => '',
'description' => t('The URL to the original flickr photo page.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
),
'primary key' => array(
'code',
),
);
$schema['media_flickr_sizes'] = array(
'description' => t('Stores file information and data for individual flickr images, possibly including a local file.'),
'fields' => array(
'code' => array(
'default' => '',
'description' => t('The flickr photo code.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'size' => array(
'description' => t("The size of this image, from 0-5, corresponding to Flickr's sizes."),
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'fid' => array(
'description' => t("The {file}.fid of this photo's local file, if set."),
'not null' => TRUE,
'type' => 'int',
'unsigned' => TRUE,
),
),
'primary key' => array(
'code',
),
'indexes' => array(
'fid' => array(
'fid',
),
'size' => array(
'size',
),
),
);
$schema['media_flickr_sets'] = array(
'description' => t('Stores photos for flickr photosets.'),
'fields' => array(
'photoset' => array(
'default' => '',
'description' => t('The flickr photoset code.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
'code' => array(
'default' => '',
'description' => t('The flickr photo code.'),
'length' => 255,
'not null' => TRUE,
'type' => 'varchar',
),
),
'primary key' => array(
'photoset',
),
'indexes' => array(
'code' => array(
'code',
),
),
);
$ret = array();
if (!db_table_exists('media_flickr')) {
db_create_table($ret, 'media_flickr', $schema['media_flickr']);
}
if (!db_table_exists('media_flickr_sizes')) {
db_create_table($ret, 'media_flickr_sizes', $schema['media_flickr_sizes']);
}
if (!db_table_exists('media_flickr_sets')) {
db_create_table($ret, 'media_flickr_sets', $schema['media_flickr_sets']);
}
return $ret;
}