You are here

function brilliant_gallery_schema in Brilliant Gallery 7.2

Same name and namespace in other branches
  1. 6.4 brilliant_gallery.install \brilliant_gallery_schema()
  2. 6 brilliant_gallery.install \brilliant_gallery_schema()
  3. 6.2 brilliant_gallery.install \brilliant_gallery_schema()
  4. 6.3 brilliant_gallery.install \brilliant_gallery_schema()
  5. 7 brilliant_gallery.install \brilliant_gallery_schema()

Implements hook_schema().

File

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

Code

function brilliant_gallery_schema() {
  $schema = array();
  $schema['brilliant_gallery_sources'] = array(
    'description' => 'Caches some information about all images under the main Brilliant Gallery album folder.',
    'fields' => array(
      'pathname_hash' => array(
        'type' => 'varchar',
        'length' => 32,
        'description' => 'Hash based on path and filename.',
        'not null' => TRUE,
      ),
      'path' => array(
        'description' => 'Path to the image relative to the main album folder, without starting or ending slashes.',
        'type' => 'varchar',
        'length' => '2048',
        'not null' => TRUE,
      ),
      'filename' => array(
        'description' => 'File name of the image.',
        'type' => 'text',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'mtime' => array(
        'description' => 'Date and time of last change of this file.',
        'type' => 'datetime',
        'mysql_type' => 'DATETIME',
        'pgsql_type' => 'timestamp without time zone',
        'sqlite_type' => 'VARCHAR',
        'sqlsrv_type' => 'smalldatetime',
        'not null' => TRUE,
      ),
      'datime' => array(
        'description' => 'Date and time of this file row insert or update.',
        'type' => 'datetime',
        'mysql_type' => 'DATETIME',
        'pgsql_type' => 'timestamp without time zone',
        'sqlite_type' => 'VARCHAR',
        'sqlsrv_type' => 'smalldatetime',
        'not null' => TRUE,
      ),
      'hidden' => array(
        'description' => 'A flag indicating the given image was marked to remain hidden.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
      'caption' => array(
        'description' => 'Caption for the image.',
        'type' => 'text',
        'size' => 'tiny',
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'pathname_hash',
    ),
    /*
    'unique keys' => array(
      'path_filename_mtime' => array(
        array('path', 255),
        array('filename', 255),
        'mtime',
      ),
    ),
    */
    'indexes' => array(
      'path' => array(
        array(
          'path',
          255,
        ),
      ),
      'filename' => array(
        array(
          'filename',
          255,
        ),
      ),
      'mtime' => array(
        'mtime',
      ),
      'datime' => array(
        'datime',
      ),
      'hidden' => array(
        'hidden',
      ),
      'caption' => array(
        array(
          'caption',
          20,
        ),
      ),
    ),
  );
  return $schema;
}