You are here

brilliant_gallery.install in Brilliant Gallery 6

File

brilliant_gallery.install
View source
<?php

/**
 * Implementation of hook_schema().
 */
function brilliant_gallery_schema() {
  $schema['brilliant_gallery_checklist'] = array(
    'description' => t('Table tracing which Brilliant Gallery images are hidden or visible.'),
    'fields' => array(
      'nid' => array(
        'description' => t('Unused now.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'normal',
        'default' => 0,
      ),
      'user' => array(
        'description' => t('User ID.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'normal',
        'default' => 0,
      ),
      'qid' => array(
        'description' => t('Image.'),
        'type' => 'text',
        #'unsigned' => FALSE,
        'not null' => TRUE,
        'size' => 'normal',
      ),
      'state' => array(
        'description' => t('Visible or invisible.'),
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'size' => 'normal',
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
      'user',
      array(
        'qid',
        255,
      ),
    ),
  );
  return $schema;
}

/**
 * Implementation of hook_install().
 */
function brilliant_gallery_install() {

  // Create tables.
  $result = drupal_install_schema('brilliant_gallery');
}

/*
CREATE TABLE `db14656_vacil_drupal`.`brilliant_gallery_checklist` (
`nid` INT unsigned NOT NULL DEFAULT 0, 
`user` INT unsigned NOT NULL DEFAULT 0, 
`qid` TEXT NOT NULL, 
`state` INT unsigned NOT NULL DEFAULT 0, 
PRIMARY KEY (nid, user, qid(255))
);
*/

/*
function brilliant_gallery_install() {
  // Create tables.
  drupal_set_message(t('Creating brilliant_gallery_checklist table.'));
  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      db_query("CREATE TABLE brilliant_gallery_checklist (
	    nid int NOT NULL default 0,
      user int NOT NULL default 0,
	    qid text NOT NULL,
	    state int NOT NULL default 0,
	    PRIMARY KEY (nid, user, qid(255))
	    );"
      );
      $sucess = TRUE;
      break;
    case 'pgsql':
      db_query("CREATE TABLE brilliant_gallery_checklist (
	    nid int NOT NULL default 0,
            user int NOT NULL default 0,
	    qid text NOT NULL,
	    state int NOT NULL default 0,
	    PRIMARY KEY (nid, user, qid)
	    );
          ");
      $sucess = TRUE;
      break;
    default:
      drupal_set_message(t("Error: Unsupported database"));
  }
  if ($success) {
    drupal_set_message(t("Tables created successfully"));
  }
}
*/

/**
* Implementation of hook_uninstall().
*/
function brilliant_gallery_uninstall() {

  // Remove tables.
  drupal_uninstall_schema('brilliant_gallery');
}

/**
 * Implementation(s) of hook_update_N().
 */
function brilliant_gallery_update_6000() {
  $ret = array();
  return $ret;
}

Functions

Namesort descending Description
brilliant_gallery_install Implementation of hook_install().
brilliant_gallery_schema Implementation of hook_schema().
brilliant_gallery_uninstall Implementation of hook_uninstall().
brilliant_gallery_update_6000 Implementation(s) of hook_update_N().