[support] Drupal 7 Install File Issue

Vaibhav Jain in.vaibhavjain at gmail.com
Wed Aug 8 04:27:20 UTC 2012


In Drupal 7,  you need not to use the statement "db_query("DROP TABLE
res_sbmt");"
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 :).

On Wed, Aug 8, 2012 at 7:35 AM, Kamal Palei <palei.kamal at gmail.com> wrote:

> Hi Drupal Experts
> Greetings of the day!!!
>
> I am relatively new to Drupal 7.
>
> 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.
> 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).
> 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?
>
> Did anybody face this problem anytime?
> Please let me know what could be the issue here?
>
> --------------------- resmsubmt.install file
> --------------------------------
>
> <?php
> function resmsubmt_schema() {
>   $schema['res_sbmt'] = array(
>     'description' => 'The base tables for resume submission.',
>     'fields' => array(
>       'uid' => array(
>         'description' => 'Id of candidate.',
>         'type' => 'serial',
>         'unsigned' => TRUE,
>         'not null' => TRUE,
>       ),
>       'name' => array(
>         'description' => 'Name of candidate.',
>         'type' => 'varchar',
>         'length' => 64,
>         'not null' => TRUE,
>         'default' => '',
>       ),
>     ),
>     'primary key' => array('uid'),
>   );
>
>   return $schema;
> }
>
> function resmsubmt_uninstall() {
>   drupal_uninstall_schema('resmsubmt');
>   db_query("DROP TABLE res_sbmt");
>   cache_clear_all('variables', 'cache');
> }
>
>
> Regards
> Kamal
> Necs
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>



-- 
Regards,
Vaibhav Jain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120808/e29a7df7/attachment.html 


More information about the support mailing list