You are here

function node_gallery_schema in Node Gallery 6.3

Same name and namespace in other branches
  1. 6 node_gallery.install \node_gallery_schema()
  2. 6.2 node_gallery.install \node_gallery_schema()

Implements hook_schema()

Return value

unknown

1 call to node_gallery_schema()
node_gallery_update_6300 in ./node_gallery.install
MAJOR UPGRADE - please don't blindly update from 2.x to 3.x! Your data will migrate, but some of your settings and most of your theming will need to be redone.

File

./node_gallery.install, line 25
Install, update and uninstall functions for the node_gallery module.

Code

function node_gallery_schema() {
  $schema = array();
  $schema['node_gallery_relationships'] = array(
    'fields' => array(
      'rid' => array(
        'type' => 'serial',
        'not null' => TRUE,
        'description' => t('Node Gallery Relationship ID'),
      ),
      'gallery_type' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'description' => t('Node Gallery Gallery Content Type.'),
      ),
      'image_type' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'description' => t('Node Gallery Image Content Type.'),
      ),
      'imagefield_name' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'length' => 255,
        'description' => t('The name of the imagefield that contains the image on an image node.'),
      ),
      'settings' => array(
        'type' => 'text',
        'not null' => FALSE,
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'rid',
    ),
  );
  $schema['node_gallery_images'] = array(
    'fields' => array(
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Image node id.'),
      ),
      'gid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Gallery node id.'),
      ),
      'weight' => array(
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'nid',
    ),
    'indexes' => array(
      // For quick finding of the contents of a gallery
      'gallery' => array(
        'gid',
      ),
    ),
  );
  $schema['node_gallery_galleries'] = array(
    'fields' => array(
      'gid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Gallery node id.'),
      ),
      'cover_image' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'default' => NULL,
        'description' => t('Node Id of the Cover Image'),
      ),
      'img_count' => array(
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Gallery images count.'),
      ),
      'pub_img_count' => array(
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => t('Gallery published images count.'),
      ),
    ),
    'primary key' => array(
      'gid',
    ),
    'unique keys' => array(
      // To quickly answer, is this image the cover image?
      'cover_image' => array(
        'cover_image',
      ),
    ),
    'indexes' => array(
      'img_count' => array(
        'img_count',
      ),
      'pub_img_count' => array(
        'pub_img_count',
      ),
    ),
  );
  return $schema;
}