Fix for getting error while installing .. near "_drupal_initialize_schema" and "drupal_install_schema" at foreach($schema as $name => ..

  1. <?php # vim: set filetype=php expandtab tabstop=2 shiftwidth=2 autoindent smartindent:
  2. /*
  3.  * Created on Mar 9, 2008
  4.  *
  5.  * file: emlex_account.install
  6.  * Author: Kamanashis Roy (kamanashisroy@gmail.com)
  7.  */
  8.  
  9. function emlex_account_install() {
  10.   drupal_install_schema('email_account');
  11.   // XXX Trying only one table now, still not working :(
  12.   // drupal_install_schema('email_fetch_history');
  13. }
  14.  
  15. function emlex_account_schema() {
  16.   $schema['email_account'] = array(
  17.     'fields' => array(
  18.       'nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  19.       'vid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  20.       'email'  => array('type' => 'text', 'not null' => TRUE),
  21.       'acctype' => array('type' => 'int', 'size' => 'tiny', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  22.       'username'  => array('type' => 'text', 'not null' => TRUE),
  23.       'password'  => array('type' => 'text', 'not null' => TRUE),
  24.     ),
  25.     'primary key' => array('nid', 'vid'),
  26.     'indexes' => array(
  27.       'email_account_id' => array('nid')
  28.     ),
  29.   );
  30.   $schema['email_fetch_history'] = array(
  31.     'fields' => array(
  32.       /* == This table will be changed upon some examinatino on batch API .. == */
  33.       'id' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  34.       'aid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0),
  35.       'changed'  => array('type' => 'datetime', 'not null' => TRUE, 'default' => 0),
  36.       'status'  => array('type' => 'text', 'not null' => TRUE),
  37.     ),
  38.     'primary key' => array('id'),
  39.     'indexes' => array(
  40.       'email_account_id' => array('aid')
  41.     ),
  42.   );
  43.   return $schema;
  44. }
  45.  
  46. function emlex_account_uninstall() {
  47.   drupal_uninstall_schema('email_account');
  48.   // drupal_uninstall_schema('email_fetch_history');
  49. }

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.