Check effect of hook_schema_alter() hook I want to alter the comment subject field title width.

Core comment module sets it to 64 characters, and I want to change it up to 100 characters.

Now I tried to alter the schema using hook_schema_alter() function. Below is my code snippet, which I tried,

/**
 * Implements hook_schema_alter().
 */
function comment_alter_schema_alter(&amp;$schema) {
    if (isset($schema['comment'])) {
        $schema['comment']['fields']['subject'] = array(
        'type' =&gt; 'varchar',
        'length' =&gt; 100,
        'not null' =&gt; TRUE,
        'default' =&gt; '',
        'description' =&gt; 'The comment title.',
        );
    }
}


I am confused whether do I have to write some stuff in .install file or not?

Now after installing module how can i check whether the width of subject field is increased or not. If I see the comment table then it is as it is to 64 characters. I could find this in your table structure using PHPMyAdmin.
This hook is not used to edit the database as such. It is used to alter the schema when using the drupal_get_schema


  Gets the schema definition of a table, or the whole database schema.
  
  The returned schema will include any modifications made by any module
  that implements hook_schema_alter().


To do what you want you will have to use the db_change_field and this would go in the .install file. 

You can check out the Schema API to get other relavent functions

You have to write db_change_field() in hook_enable() function.

Here is my modified answer:

/**
 * Implements hook_enable().
 */
function comment_alter_enable() {
    db_change_field('comment', 'subject', 'subject', array(
        'type' =&gt; 'varchar',
        'length' =&gt; 100,
        'not null' =&gt; TRUE,
        'default' =&gt; '',
        'description' =&gt; 'The comment title.',
        )
    );
}