Hi All I have a small install file as below. *<?php function resume_submit_install() { drupal_install_schema('resume_table'); } function resume_submit_uninstall() { drupal_uninstall_schema('resume_table'); } function resume_table_schema() { $schema['resume_table'] = array( 'fields' => array( 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'name' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'email' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'altemail' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), ), 'indexes' => array('uid' => array('uid'),), 'primary key' => array('name'), );* * return $schema; }* When I install the custom module, it installs without any warning/error. But on form submit, when I try to save some data, it gives warning (table does not exist). Can somebody help me to understand, what could be the issue. Thanks Austin
Hi Austin hook_install only runs once, when the module is first enabled - is it possible that you enabled it and then added the install hooks? If so, it would be worth uninstalling the module and reinstalling it. (Uninstalling is not disabling it). Devel module provides a nice utility to let you easily uninstall and reinstall a module to aid with debugging your install files. Lee On Thu, 2011-03-17 at 09:14 +0530, Austin Einter wrote:
Can somebody help me to understand, what could be the issue.
Hi Lee Steps followed as below. 1. Wrote the custom module without install file. 2. Enabled the module. 3. After the front end (form) was finalized, I wrote .install file. 4. Disabled module. 5. Cleared cache 6. Enabled module. So with this, I see the database issue. ------------------------- Coming back to devel module usage, I will check it and revert back. Thanks Austin On Thu, Mar 17, 2011 at 9:25 AM, Lee Rowlands <contact@rowlandsgroup.com>wrote:
Hi Austin hook_install only runs once, when the module is first enabled - is it possible that you enabled it and then added the install hooks? If so, it would be worth uninstalling the module and reinstalling it. (Uninstalling is not disabling it). Devel module provides a nice utility to let you easily uninstall and reinstall a module to aid with debugging your install files.
Lee
On Thu, 2011-03-17 at 09:14 +0530, Austin Einter wrote:
Can somebody help me to understand, what could be the issue.
Hi Austin The install hook won't run when you enable the module if you've already enabled it once before. There is an uninstall tab on the modules page - use that and uninstall your module then reenable it - or use drush to uninstall it (note uninstall does not equal disable). Lee On Thu, 2011-03-17 at 10:18 +0530, Austin Einter wrote:
Hi Lee
Steps followed as below.
1. Wrote the custom module without install file. 2. Enabled the module. 3. After the front end (form) was finalized, I wrote .install file. 4. Disabled module. 5. Cleared cache 6. Enabled module.
So with this, I see the database issue.
-------------------------
Coming back to devel module usage, I will check it and revert back.
Thanks Austin
On Thu, Mar 17, 2011 at 9:25 AM, Lee Rowlands <contact@rowlandsgroup.com> wrote:
Hi Austin hook_install only runs once, when the module is first enabled - is it possible that you enabled it and then added the install hooks? If so, it would be worth uninstalling the module and reinstalling it. (Uninstalling is not disabling it). Devel module provides a nice utility to let you easily uninstall and reinstall a module to aid with debugging your install files.
Lee
On Thu, 2011-03-17 at 09:14 +0530, Austin Einter wrote:
> > Can somebody help me to understand, what could be the issue.
you can use schema module to generate the install file contents. On Thu, Mar 17, 2011 at 9:14 AM, Austin Einter <austin.einter@gmail.com>wrote:
Hi All I have a small install file as below.
*<?php function resume_submit_install() { drupal_install_schema('resume_table'); } function resume_submit_uninstall() { drupal_uninstall_schema('resume_table'); } function resume_table_schema() { $schema['resume_table'] = array(
'fields' => array( 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'name' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'email' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'altemail' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), ),
'indexes' => array('uid' => array('uid'),),
'primary key' => array('name'), );* * return $schema; }*
When I install the custom module, it installs without any warning/error. But on form submit, when I try to save some data, it gives warning (table does not exist).
Can somebody help me to understand, what could be the issue.
Thanks Austin
-- Regards, Vaibhav Jain
Also, your module appears to be named 'resume_submit' so resume_table_schema should be named resume_submit_schema and you should call drupal_(un)install_schema('resume_submit') as the parameter is the module name whos schema is being (un)installed. It's fine to leave the table name as resume_table. Dave Reid dave@davereid.net On Wed, Mar 16, 2011 at 10:44 PM, Austin Einter <austin.einter@gmail.com>wrote:
Hi All I have a small install file as below.
*<?php function resume_submit_install() { drupal_install_schema('resume_table'); } function resume_submit_uninstall() { drupal_uninstall_schema('resume_table'); } function resume_table_schema() { $schema['resume_table'] = array(
'fields' => array( 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'name' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'email' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'altemail' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), ),
'indexes' => array('uid' => array('uid'),),
'primary key' => array('name'), );* * return $schema; }*
When I install the custom module, it installs without any warning/error. But on form submit, when I try to save some data, it gives warning (table does not exist).
Can somebody help me to understand, what could be the issue.
Thanks Austin
Lee, Dave, Vaibhav Thanks for your help. With help of devel module, I reinstalled my custom module and it is working fine now. Best Regards Austin On Thu, Mar 17, 2011 at 11:44 AM, Dave Reid <dave@davereid.net> wrote:
Also, your module appears to be named 'resume_submit' so resume_table_schema should be named resume_submit_schema and you should call drupal_(un)install_schema('resume_submit') as the parameter is the module name whos schema is being (un)installed. It's fine to leave the table name as resume_table.
Dave Reid dave@davereid.net
On Wed, Mar 16, 2011 at 10:44 PM, Austin Einter <austin.einter@gmail.com>wrote:
Hi All I have a small install file as below.
*<?php function resume_submit_install() { drupal_install_schema('resume_table'); } function resume_submit_uninstall() { drupal_uninstall_schema('resume_table'); } function resume_table_schema() { $schema['resume_table'] = array(
'fields' => array( 'uid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0), 'name' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'email' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), 'altemail' => array('type' => 'varchar', 'not null' => TRUE, 'default' => ''), ),
'indexes' => array('uid' => array('uid'),),
'primary key' => array('name'), );* * return $schema; }*
When I install the custom module, it installs without any warning/error. But on form submit, when I try to save some data, it gives warning (table does not exist).
Can somebody help me to understand, what could be the issue.
Thanks Austin
participants (4)
-
Austin Einter -
Dave Reid -
Lee Rowlands -
Vaibhav Jain