I want to create database table for my custom module.
Inside mymodule.install
I have:
function mymodule_schema(){
$schema['a_visits'] = array(
'description' => 'visits table',
'fields' => array(
'id' => array(
'description' => 'make id primary key auto increment',
'type' => 'serial',
'not null' => TRUE,
),
'oferta' => array(
'description' => 'nazwa oferty',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
)
),
'primary key' => array('id'),
);
return $schema;
}
function mymodule_install() {
drupal_install_schema('a_visits');
}
function mymodule_uninstall() {
drupal_uninstall_schema('a_visits');
}
Then I've moved the module's file to server under sites/all/modules/custom/mymodule
and enabled it via admin panel. Unfortunately no table in database has been created (the module is listed as active now).