function db_change_field

7.x database.inc db_change_field($table, $field, $field_new, $spec, $keys_new = array())
6.x database.pgsql.inc db_change_field(&$ret, $table, $field, $field_new, $spec, $new_keys = array())
6.x database.mysql-common.inc db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array())

Related topics

13 calls to db_change_field()
dblog_update_6000 in drupal-6.x/modules/dblog/dblog.install
Allow longer referrers.
db_add_field in drupal-6.x/includes/database.mysql-common.inc
Add a new field to a table.
statistics_update_6000 in drupal-6.x/modules/statistics/statistics.install
Allow longer referrers.
system_update_6002 in drupal-6.x/modules/system/system.install
Increase the maximum length of variable names from 48 to 128.
system_update_6019 in drupal-6.x/modules/system/system.install
Reconcile small differences in the previous, manually created mysql and pgsql schemas so they are the same and can be represented by a single schema structure.

... See full list

File

drupal-6.x/includes/database.mysql-common.inc, line 523
Functions shared between mysql and mysqli database engines.

Code

function db_change_field(&$ret, $table, $field, $field_new, $spec, $keys_new = array()) {
  $sql = 'ALTER TABLE {' . $table . '} CHANGE `' . $field . '` ' .
    _db_create_field_sql($field_new, _db_process_field($spec));
  if (count($keys_new)) {
    $sql .= ', ADD ' . implode(', ADD ', _db_create_keys_sql($keys_new));
  }
  $ret[] = update_sql($sql);
}