function photos_update_3 in Album Photos 6.2
File
- ./
photos.install, line 219
Code
function photos_update_3() {
$ret = array();
$schema['x_node'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'fid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
),
'indexes' => array(
'nid' => array(
'nid',
),
'fid' => array(
'fid',
),
),
);
db_create_table($ret, 'x_node', $schema['x_node']);
db_drop_index($ret, 'x_vote', 'cid');
db_drop_index($ret, 'x_album', 'uid');
db_change_field($ret, 'x_album', 'uid', 'count', array(
'type' => 'int',
'not null' => TRUE,
));
db_add_index($ret, 'x_album', 'count', array(
'count',
));
db_add_field($ret, 'x_album', 'data', array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
));
$result = db_query('SELECT pid FROM {x_album} ORDER BY pid ASC');
while ($image = db_fetch_object($result)) {
db_query('UPDATE {x_album} SET count = (SELECT count(pid) FROM {x_image} WHERE pid = %d) WHERE pid = %d', $image->pid, $image->pid);
}
return $ret;
}