You are here

function scald_schema in Scald: Media Management made easy 7

Same name and namespace in other branches
  1. 6 scald.install \scald_schema()

Implements hook_schema().

File

./scald.install, line 22

Code

function scald_schema() {
  $schema = array();
  $schema['cache_scald'] = drupal_get_schema_unprocessed('system', 'cache');
  $schema['scald_atoms'] = array(
    'description' => 'The Scald Atom registry.',
    'fields' => array(
      'sid' => array(
        'description' => 'The Scald Identifier, a unique integer ID for a given Scald Atom.',
        'type' => 'serial',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'provider' => array(
        'description' => 'The name of the module which provides this Atom.  The Provider module should implement the Scald Provider API for Atoms.  FK {system}.name',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'scald',
      ),
      'type' => array(
        'description' => 'The Scald Unified Type slug for this Atom\'s type.  FK {scald_types}.type',
        'type' => 'varchar',
        'length' => SCALD_SLUG_MAX_LENGTH,
        'not null' => TRUE,
      ),
      'base_id' => array(
        'description' => 'The identifier used by the Scald Atom Provider that registered Atom to determine additional properties (e.g. a Drupal NID or a YouTube ID).  FK',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => NULL,
      ),
      'language' => array(
        'description' => 'The {languages}.language of this atom.',
        'type' => 'varchar',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ),
      'publisher' => array(
        'description' => 'The Drupal User ID of the user who *registered* this Atom.  Makes no implications about the Authorship.  FK {users}.uid',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'actions' => array(
        'description' => 'The Scald Actions bitstring for this Atom.',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'title' => array(
        'description' => 'The title of this Scald Atom.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'data' => array(
        'description' => 'A serialized array of atom and provider specific additionnal data.',
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
      ),
      'created' => array(
        'description' => 'The Unix timestamp when the atom was created.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'changed' => array(
        'description' => 'The Unix timestamp when the atom was most recently saved.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'sid',
    ),
    'indexes' => array(
      'i_sid_provider_base_id' => array(
        'sid',
        array(
          'provider',
          64,
        ),
        array(
          'base_id',
          64,
        ),
      ),
      'i_sid_actions' => array(
        'sid',
        'actions',
      ),
      'i_type_sid' => array(
        'type',
        'sid',
      ),
      'i_publisher_sid' => array(
        'publisher',
        'sid',
      ),
      'i_base_id' => array(
        array(
          'base_id',
          64,
        ),
      ),
      'i_provider_type_base_id' => array(
        array(
          'provider',
          64,
        ),
        array(
          'type',
          64,
        ),
        array(
          'base_id',
          64,
        ),
      ),
      'atom_changed' => array(
        'changed',
      ),
      'atom_created' => array(
        'created',
      ),
    ),
  );
  $schema['scald_types'] = array(
    'description' => 'The Scald Unified Type registry.',
    'fields' => array(
      'type' => array(
        'description' => 'The Scald Unified Type slug, used to uniquely identify the Type',
        'type' => 'varchar',
        'length' => SCALD_SLUG_MAX_LENGTH,
        'not null' => TRUE,
      ),
      'provider' => array(
        'description' => 'The name of the module which provides this Type.  The Provider module should implement the Scald Provider API for Types.  FK {system}.name',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'scald',
      ),
      'title' => array(
        'description' => 'The human-readable title of this Type.  Publicly Viewable',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'description' => array(
        'description' => 'A description of the Type for the benefit of Admins and Devs.',
        'type' => 'text',
        'size' => 'medium',
      ),
    ),
    'primary key' => array(
      'type',
    ),
  );
  $schema['scald_context_config'] = array(
    'description' => 'Context configuration.',
    'fields' => array(
      'context' => array(
        'description' => 'The Scald Context slug for a Scald Context. Fk {scald_contexts}.context',
        'type' => 'varchar',
        'length' => SCALD_SLUG_MAX_LENGTH,
        'not null' => TRUE,
      ),
      'transcoder' => array(
        'description' => 'A serialized array of transcoder per format.',
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
      'player' => array(
        'description' => 'A serialized array of player per type.',
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
      'data' => array(
        'description' => 'Arbitrary data.',
        'type' => 'blob',
        'size' => 'big',
        'not null' => TRUE,
        'serialize' => TRUE,
        'object default' => array(),
      ),
    ),
    'primary key' => array(
      'context',
    ),
    'export' => array(
      'key' => 'context',
      'key name' => 'Context',
      'primary key' => 'context',
      'identifier' => 'context_config',
      'export type string' => 'ctools_type',
      'api' => array(
        'owner' => 'scald',
        'api' => 'context_config',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
  );
  $schema['scald_licenses'] = array(
    'description' => 'Definitions of Licenses as sets of permitted Scald Actions',
    'fields' => array(
      'lid' => array(
        'description' => 'The License ID; an arbitrarily defined identifier for the license.',
        'type' => 'serial',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'title' => array(
        'description' => 'The human-readable name of this License (often presented as an alternative for users).',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => 'Scald License Default Title',
      ),
      'description' => array(
        'description' => 'A description of a given License for public consumption.',
        'type' => 'text',
        'size' => 'medium',
      ),
      'actions' => array(
        'description' => 'The Scald Action bitstring for this License.',
        'type' => 'int',
        'size' => 'big',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'lid',
    ),
  );
  return $schema;
}