nodereference.install in Content Construction Kit (CCK) 6
File
modules/nodereference/nodereference.install
View source
<?php
function nodereference_install() {
content_notify('install', 'nodereference');
}
function nodereference_uninstall() {
content_notify('uninstall', 'nodereference');
}
function nodereference_enable() {
content_notify('enable', 'nodereference');
}
function nodereference_disable() {
content_notify('disable', 'nodereference');
}
function nodereference_update_last_removed() {
return 3;
}
function nodereference_update_6000() {
$ret = array();
include_once './' . drupal_get_path('module', 'content') . '/content.module';
content_clear_type_cache();
include_once './' . drupal_get_path('module', 'content') . '/content.install';
$types = content_types_install();
foreach ($types as $type_name => $fields) {
foreach ($fields as $field) {
switch ($field['type']) {
case 'nodereference':
$db_info = content_database_info($field);
$table = $db_info['table'];
$column = $db_info['columns']['nid']['column'];
db_change_field($ret, $table, $column, $column, array(
'type' => 'int',
'not null' => FALSE,
));
db_field_set_no_default($ret, $db_info['table'], $column);
$ret[] = update_sql("UPDATE {" . $db_info['table'] . "} SET " . $column . " = NULL WHERE " . $column . " = 0");
}
}
}
return $ret;
}