db_add_field not working I want to add a new field to node  table using db_add_field when intalling a new module, but it seems there is something wrong or missing:
here is the code used:
/**
* Implements hook_schema_alter()
*/
function smart_delete_schema_alter(&amp;$schema) {
  // Add field to existing schema.
  $schema['node']['fields']['show_in_inbox'] = array(
    'type' =&gt; 'int',
    'length' =&gt; '4',
    'default' =&gt; '1',
    'not null' =&gt; TRUE,
    'unsigned' =&gt; TRUE,  
    'description' =&gt; 'Field added by Smart_delete module',
  ); 
}

/**
* Implements hook_install()
*/
function smart_delete_install(){
    if (!db_field_exists('node', 'show_in_inbox')) {
        $schema = drupal_get_schema('node');
        db_add_field('node', 'show_in_inbox', $schema['fields']['show_in_inbox']);
    }
}

ADD :
I made an db_query in hook_init() inside .module file :
$result = db_query(&quot;ALTER TABLE `node` ADD `show_in_inbox` TINYINT NOT NULL DEFAULT '1';&quot;);

this is working, but the same db_query in .install file is not working when disable/enable the module again!
(I cleared the cache, also add the file in .info file)
I don't think length is valid for integers. size is though:

$schema['node']['fields']['show_in_inbox'] = array(
  'type' =&gt; 'int',
  'size' =&gt; 'tiny',
  'default' =&gt; '1',
  'not null' =&gt; TRUE,
  'unsigned' =&gt; TRUE,  
  'description' =&gt; 'Field added by Smart_delete module',
);


Data Types