You are here

function ed_classified_schema_drupal5 in Classified Ads 5.2

Same name and namespace in other branches
  1. 6.2 ed_classified.install \ed_classified_schema_drupal5()
  2. 7.2 ed_classified.install \ed_classified_schema_drupal5()
1 call to ed_classified_schema_drupal5()
ed_classified_install in ./ed_classified.install

File

./ed_classified.install, line 50

Code

function ed_classified_schema_drupal5() {
  drupal_set_message(t('Creating classified ads table'));
  $success = FALSE;
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $success = db_query("CREATE TABLE {edi_classified_nodes} (\n        nid int(10) unsigned NOT NULL default '0',\n        vid int(10) unsigned NOT NULL default '0',\n        expires_on int(10) unsigned NOT NULL default '0' COMMENT 'Unix timestamp of expiration',\n        expiration_notify_last_sent int(10) unsigned NOT NULL default '0',\n        PRIMARY KEY (nid,vid));");
      break;
    case 'pgsql':
      $success = db_query("CREATE TABLE {edi_classified_nodes} (\n        nid serial CHECK (nid >=0),\n        vid int_unsigned NOT NULL default '0',\n        expires_on int_unsigned NOT NULL default '0',\n        expiration_notify_last_sent int_unsigned NOT NULL default '0',\n        PRIMARY KEY (nid));");
      break;
  }
  if ($success) {
    drupal_set_message(t('Classified module table creation successful.'));
  }
  else {
    drupal_set_message(t('Classified module table creation was unsuccessful. Check the watchdog logs.'), 'error');
  }
}