How to create a table during the module installation
-
31-10-2019 - |
Question
I'm trying to create a module for Drupal 7 and I need to create 3 tables and populate it. But first i need to create it.
In the file mymodule.install I have got
function mymodule_install() {
}
function mymodule_uninstall() {
}
function myodule_schema() {
$schema['mymodule_table'] = array(
'description' => t('First table'),
'fields' => array(
'id' => array(
'description' => t('My unique identifier'),
'type' => 'int',
'unsigned' => true,
'not null' => true,
),
'list' => array(
'description' => t('list'),
'type' => 'varchar',
'not null' => true,
),
),
'primary key' => array('id'),
);
return $schema;
}
What am I doing wrong? Every time I test the module, I disable it -> uninstall -> Performance clear cache -> enable it.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange