You are here

function fe_paths_schema in File Entity Paths 7.2

Implements hook_schema().

File

./fe_paths.install, line 12
Install, update and uninstall functions for the File Entity Paths module. @todo: Figure out, how should this work with Filefield Paths. Now, the filefield_paths has partial media + File Entity support

Code

function fe_paths_schema() {
  $schema['fe_paths_config'] = array(
    'description' => 'Table definition for fe_paths config entity schema. ',
    'fields' => array(
      'id' => array(
        'description' => 'The unique identifier for config.',
        'not null' => TRUE,
        'type' => 'serial',
      ),
      'machine_name' => array(
        'type' => 'varchar',
        'length' => '64',
        'not null' => TRUE,
        'description' => 'The machine name of the configuration.',
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'description' => 'The label of the configuration.',
        'default' => 'unlabeled',
      ),
      'module' => array(
        'description' => 'The name of the providing module if the entity has been defined in code. (Need for exportables.)',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
      ),
      'status' => array(
        'description' => 'Boolean indicating whether the configuration is active. (Need for exportables.)',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 1,
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
        'size' => 'tiny',
        'description' => 'Weight of the settings.',
      ),
      'path' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'description' => 'The path of this config.',
        'default' => 'unlabeled',
      ),
      'filename' => array(
        'type' => 'varchar',
        'length' => '255',
        'not null' => TRUE,
        'description' => 'The filename of this config.',
        'default' => 'unlabeled',
      ),
      'data' => array(
        'type' => 'blob',
        'size' => 'big',
        'not null' => FALSE,
        'serialize' => TRUE,
        'description' => 'The configuration data, serialized.',
      ),
    ),
    'primary key' => array(
      'id',
    ),
    'unique keys' => array(
      'machine_name' => array(
        'machine_name',
      ),
    ),
  );
  $schema['fe_paths_usage'] = array(
    'description' => 'Table definition for fe_paths usage schema. ',
    'fields' => array(
      'fid' => array(
        'description' => 'File ID.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'entity_type' => array(
        'description' => 'The name of the entity type in which the file is used.',
        'type' => 'varchar',
        'length' => '64',
        'not null' => TRUE,
        'default' => '',
      ),
      'entity_id' => array(
        'description' => 'The primary key of the entity using the file.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'id' => array(
        'description' => 'The unique identifier for config.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'fid',
    ),
  );
  return $schema;
}