You are here

brilliant_gallery.install in Brilliant Gallery 5.3

File

brilliant_gallery.install
View source
<?php

function brilliant_gallery_install() {
  drupal_set_message(t('Creating tables for brilliant gallery checklists'));
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE brilliant_gallery_checklist (\n\t    nid int NOT NULL default 0,\n            user int NOT NULL default 0,\n\t    qid text NOT NULL,\n\t    state int NOT NULL default 0,\n\t    PRIMARY KEY (nid, user, qid(255))\n\t    );");
      $sucess = TRUE;
      break;
    case 'pgsql':
      db_query("CREATE TABLE brilliant_gallery_checklist (\n\t    nid int NOT NULL default 0,\n            user int NOT NULL default 0,\n\t    qid text NOT NULL,\n\t    state int NOT NULL default 0,\n\t    PRIMARY KEY (nid, user, qid)\n\t    );\n          ");
      $sucess = TRUE;
      break;
    default:
      drupal_set_message(t("Error: Unsupported database"));
  }
  if ($success) {
    drupal_set_message(t("Tables created successfully"));
  }
}
function brilliant_gallery_update_1() {
  $items = array();
  drupal_set_message(t('Creating tables for brilliant gallery checklists'));
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      update_sql("CREATE TABLE brilliant_gallery_checklist (\n     nid int NOT NULL default 0,\n            user int NOT NULL default 0,\n     qid text NOT NULL,\n     state int NOT NULL default 0,\n     PRIMARY KEY (nid, user, qid(255))\n     );");
      $sucess = TRUE;
      break;
    case 'pgsql':
      update_sql("CREATE TABLE brilliant_gallery_checklist (\n     nid int NOT NULL default 0,\n            user int NOT NULL default 0,\n     qid text NOT NULL,\n     state int NOT NULL default 0,\n     PRIMARY KEY (nid, user, qid)\n     );\n          ");
      $sucess = TRUE;
      break;
    default:
      drupal_set_message(t("Error: Unsupported database"));
  }
  if ($success) {
    drupal_set_message(t("Tables created successfully"));
  }
  return $items;
}
function brilliant_gallery_uninstall() {
  db_query('DROP TABLE {brilliant_gallery_checklist}');
}