How do I create a database table in the setup file for a Drupal module?
2 answers
You need to implement in your unit install_schema
and uninstall_schema
hooks that return information about the circuit. They are converted to a create and drop table and executed by Drupal when your module is enabled or removed. Read more in the schema API .
-3
a source to share
Old post, I know, but for the sake of completeness:
hook_install_schema and hook_uninstall_schema are no longer needed since drupal 7.x
http://api.drupal.org/api/drupal/includes--database--schema.inc/group/schemaapi
You can just get rid of the hook_schema () implementation.
+7
a source to share