Fix for Fix for Issue with hook_schema and installing a module -- it doesn't create the table

  1. /**
  2.  * Implementation of hook_install().
  3.  */
  4. function header_links_install() {
  5.   drupal_install_schema('header_links');
  6. }
  7.  
  8. /**
  9.  * Implementation of hook_uninstall().
  10.  */
  11. function header_links_uninstall() {
  12.   drupal_uninstall_schema('header_links');
  13. }
  14.  
  15. /**
  16.  * Implementation of hook_schema().
  17.  */
  18. function header_links_schema() {
  19.   $schema['header_links'] = array(
  20.     'fields' => array(
  21.       'vid'                             => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  22.       'nid'                             => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  23.       'nid_link'                        => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  24.       'external_link'   => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
  25.       'type_link'                       => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => 'interne'),
  26.       'ordre'                                   => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  27.     ),
  28.     'primary key' => array('vid', 'nid'),
  29.   );
  30.  
  31.   return $schema;
  32. }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.