Fix for Is this the right way to schema

  1. <?php
  2.  
  3.  
  4. /**
  5.  * Implementation of hook_install().
  6.  */
  7.  
  8. function another_form_install() {
  9.   drupal_install_schema('another_form');
  10. }
  11.  
  12. /**
  13.  * Implementation of hook_uninstall().
  14.  * Comment it out in production, there is no reason delete the tables that store the values
  15.  */
  16.  
  17.  
  18. function another_form_uninstall() {
  19.   drupal_uninstall_schema('another_form');
  20. }
  21.  
  22. /**
  23.  * Implementation of hook_schema().
  24.  */
  25. function another_form_schema() {
  26.   $schema = array();
  27.   $schema['another_form_sflead'] = array(
  28.       'description' => t('Lead Submissions'),
  29.       'fields' => array(
  30.         'sid' => array('description' => t('The unique identifier for this submission.'), 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, ),
  31.         'time' => array('description' => t('Timestamp of when the form was submitted.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ),
  32.         'firstname' => array('description' => 'FirstName',  'type' => 'varchar', 'length' => 255, ),
  33.         'lastname' => array('description' => 'LastName', 'type' => 'varchar', 'length' => 255, ),
  34.         'phone' => array('description' => 'Phone', 'type' => 'varchar', 'length' => 255, ),
  35.         'email' => array('description' => 'Email', 'type' => 'varchar', 'length' => 255, ),          
  36.         'newsletter' => array('description' => 'Newsletter', 'type' => 'varchar','length' => 255,),
  37.         'event' => array('description' => 'Event', 'type' => 'varchar', 'length' => 255,),
  38.         'attendees' => array('description' => 'Attendees', 'type' => 'varchar', 'length' => 255,),
  39.         'post' => array('description' => 'The Actual Post', 'type' => 'text', ),
  40.       ),
  41.    
  42.  
  43.     'unique keys' => array('sid' => array('sid')),
  44.     'primary key' => array('sid'),
  45.  
  46.   );
  47.   $schema['another_form_sfcontact'] = array(
  48.     'description' => 'Service Form Submissions.',
  49.     'fields' => array(
  50.      'sid' => array('description' => 'The unique identifier for this submission.' , 'type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE,),
  51.      'time' => array('description' => 'Timestamp of when the form was submitted.' , 'type' => 'int' , 'unsigned' => TRUE,'not null' => TRUE,'default' => 0,),
  52.      'firstname' => array('description' => 'First Name', 'type' => 'varchar', 'length' => 255, ),
  53.      'lastname' => array('description' => 'Last Name', 'type' => 'varchar','length' => 255, ),
  54.      'phone' => array('description' => 'Phone','type' => 'varchar', 'length' => 255, ),
  55.      'email' => array('description' => 'Email', 'type' => 'varchar','length' => 255, ),          
  56.      'option' => array('description' => 'Options', 'type' => 'varchar' ,'length' => 255,),
  57.      'content' => array('description' => 'Content','type' => 'varchar' , 'length' => 255, ),      
  58.      'post' => array('description' => 'The Actual Post','type' => 'text',),
  59.     ),
  60.     'unique keys' => array('sid' => array('sid')),
  61.     'primary key' => array('sid'),
  62.   );
  63.   $schema['another_form_sfemail'] = array(
  64.     'description' => 'Stores all submitted field data for salesForm submissions.',
  65.     'fields' => array(
  66.       'sid' => array('description' => 'The unique identifier for this submission.', 'type' => 'serial', 'unsigned' => TRUE,'not null' => TRUE, ),
  67.       'email' => array('description' => 'Email', 'type' => 'varchar','length' => 255, ),
  68.       'time' => array('description' => 'Time Field','type' => 'varchar','length' => 255, ),
  69.       'post' => array('description' => 'The Actual Post','type' => 'text',),
  70.     ),
  71.     'unique keys' => array('sid' => array('sid')),
  72.     'primary key' => array('sid'),
  73.   );
  74.   return $schema;
  75. }

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.