All pastes #636060 Raw Edit

Stuff

public text v1 · immutable
#636060 ·published 2007-07-27 16:10 UTC
rendered paste body
<?php
  // $Id$
  
  function annotate_install() {
    drupal_set_message(t('Beginning installation of annotate module.'));
    switch ($GLOBALS['db_type']) {
      case 'mysql':
      case 'mysqli':
        db_query("CRATE TABLE annotations (
          uid int NOT NULL default 0,
          nid int NOT NULL default 0,
          note longtext NOT NULL,
          timestamp int NOT NULL default 0,
          PRIMARY KEY (uid, nid)
          ) /*!40100 DEFAULT CHARACTER SET utf8 */;"
        );
        $success = TRUE;
        break;
      case 'pgsql':
        db_query("CREATE TABLE annotations (
          uid int NOT NULL DEFAULT 0,
          nid int NOT NULL DEFAULT 0,
          note text NOT NULL,
          timestamp int NOT NULL DEFAULT 0,
          PRIMARY KEY (uid, nid)
          );"
        );
        $success = TRUE;
        break;
      default:
        drupal_set_message(t('Unsupported database.'));
    }
    if ($success) {
      drupal_set_message(t('The module installed tables successfully.'));
    }
    else {
      drupal_set_message(t('The installation of the annotate module was unsuccessful.'), 'error');
    }
  }