By mysocom on
I have some question about .install file for my module.
Here is install function:
function license_schema() {
$schema['license'] = array(
'description' => t('Stores license for orders.'),
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => t('The primary key for license.'),
'no export' => TRUE,
),
'client_computer_id' => array(
'type' => 'varchar',
'length' => '128',
'default' => '',
'not null' => TRUE,
'description' => t('Client Computer ID.'),
),
'expiration' => array(
'type' => 'int',
'default' => 0,
'not null' => TRUE,
'disp-width' => '6'
'description' => t('License Expiration Date.'),
),
),
'primary key' => array('id'),
'indexes' => array('id' => array('id')),
);
return $schema;
}
I created it after reading http://drupal.org/node/323314
1) I don’t understand 'disp-width' => '6'
2) 'indexes' => array('id' => array('id')),
What is it for ? Is it necessary to have it ?
Comments
1. I'm not sure what the
1. I'm not sure what the 'disp-width' is either. It doesn't look to be useful or used at all. It's not documented in the Schema API or in http://drupal.org/node/323314.
2. That's not needed since you already have a primary key on the id field, which automatically creates an index. You would create additional indexes for database columns that are frequently used for sorts and conditions in your module's SQL queries.