I am creating a module for Drupal 7.x, and I want to create a database table when the module is installed (enabled for the first time). How can I do this? Thanks.
A:
You need to implement install_schema
and uninstall_schema
hooks in your module that return schema information. These are translated into table create and drop and executed by Drupal when your module is enabled or uninstalled. Read more in the Schema API.
spoulson
2010-05-13 12:25:46
And these would go in the .install file of your module. These are for Drupal 5.x, but I think they still apply:http://drupal.org/node/51220
lazysoundsystem
2010-05-13 17:40:50