file .install don't create datatable

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by ocditimban on October 2, 2011 at 2:05am

<?php
function insertTable_schema(){
$schema['example']=array(
'fields' => array(
'nid' => array('type' =>'int','not null' => TRUE,'unsigned' => TRUE,'default' =>0),
),
'primary key' => array('nid'),
);
return $schema;
}
function insertTable_install(){
db_insert('example')
->fields(array(
'nid' =>1,
))
->execute();

}
function insertTable_uninstall() {

variable_del('example_default_status');
variable_del('example_threshold_limit');
variable_del('example_threshold_window');
}

this is my code but it's don't create datatable 'example' for me. Why???

Comments

This will work for you

Posted by veeraprasadd on October 8, 2011 at 9:50am

It works for me with the same code which you are using.
Try this..

function test_schema(){
$schema['example']=array(
'fields' => array(
'nid' => array('type' =>'int','not null' => TRUE,'unsigned' => TRUE,'default' =>0),
),
'primary key' => array('nid'),
);
return $schema;
}
function test_install(){
db_insert('example')->fields(array('nid' =>1,))->execute();
}
function test_uninstall() {
variable_del('example_default_status');
variable_del('example_threshold_limit');
variable_del('example_threshold_window');
}

Regards,
Veera Prasad Dagudu
www.drup-all.com

Drupal Books in Libraries

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /