Why table creation on module install doesn’t work? and How to solve it
In Drupal 7, it is not necessary to call drupal_install_schema()
, or drupal_uninstall_schema()
; that is automatically done from Drupal. It is enough to implement hook_schema()
, and the database table is created. There are many modules for Drupal 7 implementing that hook, and their database tables are created.
Two possible causes for the database table not being created:
- The short name of the module is not bip_content_migration
- You added the
hook_schema()
implementation on an already installed module
If you installed the module, disabled it, changed the code, and re-enabled it, the database table would not be created. Disabling a module is different from uninstalling it. Uninstalling is done when a module is disabled, and then uninstalled from the “Uninstall” tab in admin/modules.
Also considering the following two cases, as Drupal should have given you some errors:
- The schema is not correct
- Drupal is not able to connect to the database, while installing the module.
If there are more databases, be sure you are looking at the right database.