I am writing a custom module for Drupal 7. For the table creation I have created the .install file, but the table is not getting created automatically, when the module is installed. I have already uninstalled and reinstalled the module many times. All the times I do it, I get the following error:
Base table or view not found: 1146 Table 'drupal.drupalform' doesn't exist
This is the code in the drupalform.install file.
function drupalform_schema() {
$schema = array();
$schema['drupalform'] = array(
'description' => t('A table for holding the drupalform data!'),
'fields' => array(
'id' => array(
'description' => t('Auto increment of the ID'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'name' => array(
'description' => t('Person\'s first name.'),
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
'last_name' => array(
'description' => t('Person\'s last name.'),
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
),
'email' => array(
'description' => t('Person\'s email'),
'type' => 'varchar',
'length' => 64,
'not null' => TRUE
),
),
'primary key' => array('id'),
);
return $schema;
}
function drupalform_install() {
drupal_install_schema('drupalform');
}
function drupalform_uninstall() {
drupal_uninstall_schema('drupalform');
}
drupalform
, that code is fine