Posted by tomas.teicher on April 15, 2010 at 11:47am
Hi i am leaarning creating install file. I want to create new table. I create very simple .install file but table is not creating. Coud anybody help me?
<?php
function mymodule_install() {
// Create tables.
drupal_install_schema('mymodule');
}
function mymodule_schema() {
$schema['mymodule'] = array(
'fields' => array(
'nid' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => t('description....'),
),
),
);
return $schema;
}
function mymodule_uninstall() {
drupal_uninstall_schema('mymodule');
}
?>
Comments
hook_schema() is only called
hook_schema() is only called on first install, not on subsequent module enables. So you will need to disable the module, click the uninstall tab, uninstall the module, then re-install it.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)
thank you, that was the
thank you,
that was the problem
Tomas