6 core.php hook_schema_alter(&$schema)
7 system.api.php hook_schema_alter(&$schema)

Performs alterations to existing database schemas.

When a module modifies the database structure of another module (by changing, adding or removing fields, keys or indexes), it should implement hook_schema_alter() to update the default $schema to take its changes into account.

See hook_schema() for details on the schema definition structure.


$schema: Nested array describing the schemas for all modules.

Return value


Related topics

1 invocation of hook_schema_alter()
drupal_get_schema in includes/common.inc
Get the schema definition of a table, or the whole database schema.


developer/hooks/core.php, line 725
These are the hooks that are invoked by the Drupal core.


function hook_schema_alter(&$schema) {
  // Add field to existing schema.
  $schema['users']['fields']['timezone_id'] = array(
    'type' => 'int',
    'not null' => TRUE,
    'default' => 0,
    'description' => 'Per-user timezone configuration.',



Thanks for the suggestion, I tried this code

function bunit_id_schema_alter(&$schema) {
// Change datatype from INT to BIGINT for the field field_bunit_identity_number_value.
$schema['content_type_benificiary']['fields']['field_bunit_identity_number_value'] = array(
'type' => 'int',
'not null' => FALSE,

Nothing Happened .... Is there any other way to change the data types ?

To the above poster:

The name hook_schema_alter() is a little misleading in that it won't actually alter the schema of the database by making changes. Rather it is used for 'reporting' changes that have been made by a module to other module's tables. This allows certain functions (such as drupal_write_record()) to get an accurate schema definition when one module changes another's tables.