In Drupal 7, you need not to use the statement "db_query("DROP TABLE res_sbmt");"<br>apart from this, if you are only using hook_install and hook_uninstall to remove schema, please dont implement that, in D7 it does of its own :).<br>
<br><div class="gmail_quote">On Wed, Aug 8, 2012 at 7:35 AM, Kamal Palei <span dir="ltr"><<a href="mailto:palei.kamal@gmail.com" target="_blank">palei.kamal@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Drupal Experts<br>Greetings of the day!!!<br><br>I am relatively new to Drupal 7.<br><br>I am facing a strange issue. Want to create a table during install of my module. My install file looks as below. My custom module name is resmsubmt.<br>
I have tried several hours (with clearing cache etc..), only 1 time I saw the table was created. I deleted that table manually (using phpmyadmin and sql statement).<br>After that I cleared cache, tried with different table names , always I find the table is not created after installing and enabling my module. Drupal shows module is installed successfully, I enable the module, I do not get any error, then why table is not getting created?<br>
<br>Did anybody face this problem anytime?<br>Please let me know what could be the issue here?<br><br>--------------------- resmsubmt.install file --------------------------------<br><br><?php<br>function resmsubmt_schema() {<br>
$schema['res_sbmt'] = array(<br> 'description' => 'The base tables for resume submission.',<br> 'fields' => array(<br> 'uid' => array(<br> 'description' => 'Id of candidate.',<br>
'type' => 'serial',<br> 'unsigned' => TRUE,<br> 'not null' => TRUE,<br> ),<br> 'name' => array(<br> 'description' => 'Name of candidate.',<br>
'type' => 'varchar',<br> 'length' => 64,<br> 'not null' => TRUE,<br> 'default' => '',<br> ),<br> ),<br> 'primary key' => array('uid'),<br>
);<br><br> return $schema;<br>}<br><br>function resmsubmt_uninstall() {<br> drupal_uninstall_schema('resmsubmt');<br> db_query("DROP TABLE res_sbmt");<br> cache_clear_all('variables', 'cache');<br>
}<br><br><br>Regards<br>Kamal<br>Necs<br>
<br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Vaibhav Jain<br>