(Newbie question) Something goes wrong here with db_add_field I'm trying to adapt that D6 module to D7.
I'm on the "add afield" part of .install

Here's my code :

function node_statistics_install() {
    db_add_field('accesslog', 'nid', array(
    'description' =&gt; 'Field added by node_statistics',
    'type' =&gt; 'int',
    'not null' =&gt; TRUE,
    'unsigned' =&gt; TRUE,
    'length' =&gt; 11,
    'default' =&gt; 0,
  ));


but nothing happens in the database on install, no errors in drupal logs...
Am I missing something?
First, make sure that Statistics module installed/enabled.

Second, replace your code with the following code:

function node_statistics_schema_alter(&amp;$schema) {
  // Add field to existing schema.
  $schema['accesslog']['fields']['nid'] = array(
    'type' =&gt; 'int',
    'length' =&gt; '11',
    'default' =&gt; '0',
    'not null' =&gt; TRUE,
    'unsigned' =&gt; TRUE,  
    'description' =&gt; 'Field added by node_statistics',
  ); 
}

function node_statistics_install() { 
  $table = 'accesslog';

  $schema = drupal_get_schema($table);

  db_add_field($table, 'nid', $schema['fields']['nid']);
}


Note: make sure to uninstall and install your module after you apply the new code.