You are here

function bynder_schema in Bynder 7

Implements hook_schema().

File

./bynder.install, line 11
Install, update and uninstall functions for the Media: Bynder module.

Code

function bynder_schema() {
  $schema['bynder_media_entity'] = array(
    'description' => 'Table to store Bynder media information.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => true,
        'not null' => true,
      ),
      'bynder_id' => array(
        'description' => 'Bynder asset unique identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'fid' => array(
        'description' => 'Drupal file identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'bynder_hash_id' => array(
        'description' => 'Bynder hash identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'name' => array(
        'description' => 'The title of the asset.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'description' => array(
        'description' => 'The description of the asset.',
        'type' => 'text',
        'size' => 'big',
        'not null' => false,
      ),
      'derivatives' => array(
        'description' => 'Derivative information.',
        'type' => 'text',
        'not null' => false,
        'size' => 'big',
        'serialize' => true,
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['bynder_media_usage'] = array(
    'description' => 'Associates stored Bynder assets with file and node ids.',
    'fields' => array(
      'id' => array(
        'type' => 'serial',
        'unsigned' => true,
        'not null' => true,
      ),
      'bynder_entity_id' => array(
        'description' => 'Bynder Drupal Entity identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'bynder_id' => array(
        'description' => 'Bynder asset unique identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'fid' => array(
        'description' => 'Drupal file identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => true,
        'default' => '',
      ),
      'nid' => array(
        'description' => 'The node identifier.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => false,
        'default' => '',
      ),
      'processed' => array(
        'description' => 'Logs if the usage entry was sent to Bynder.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'uri' => array(
        'description' => 'The media usage page url in Drupal.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The node title.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'id',
    ),
  );
  $schema['cache_bynder'] = drupal_get_schema_unprocessed('system', 'cache');
  return $schema;
}