Reputation: 631
Hi i am very new in drupal. i just create a module that create a form with some inputs. I wrote .install file for the same but it is not creating table. While i am installing this module it is neither showing error nor install table.
function mycontact_schema() {
$schema['mycontact'] = array(
'description' => t('This table for mycontact.'),
'fields' => array(
'mycontctid' => array(
'description' => t('The primary identifier for a mycontact.'),
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE),
'vid' => array(
'description' => t('The current {mycontact_revisions}.vid version identifier.'),
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0),
'name' => array(
'description' => t('The {mycontact_name} of this mycontact.'),
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => ''),
'email' => array(
'description' => t('The name of this contact, always treated a non-markup plain text.'),
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => ''),
),
'comments' => array(
'description' => t('The comments of this contact, always treated a non-markup plain text.'),
'type' => 'text',
'not null' => TRUE,
'default' => ''),
'primary key' => array('mycontctid'),
);
return $schema;
}
It is not showing any error and any warning.
Upvotes: 3
Views: 693
Reputation: 1341
There is nothing wrong in the hook_install implementation.
I followed these steps to get it working:
mycontact
inside sites/all/modules
.mycontact.info
, mycontact.module
, and mycontact.install
.Inside mycontact.info
I added the following lines:
name = my contact
core = 7.x
mycontact.install
file, I copied all the code from the question as it is.mycontact.module
file empty. Note: Drupal needs this empty file.What you could do now is, disable the module -> uninstall it -> follow the above steps to install the module; and you should have your database table created for you.
Upvotes: 1