You are here

function minisite_schema in Mini site 7

Same name and namespace in other branches
  1. 8 minisite.install \minisite_schema()

Implements hook_schema().

File

./minisite.install, line 62
Contains install and update functions for Minisite.

Code

function minisite_schema() {
  $schema['minisite_asset'] = [
    'description' => 'A list of asset information for minisite.',
    'fields' => [
      'mid' => [
        'type' => 'serial',
        'not null' => TRUE,
        'description' => 'The primary identifier for a minisite asset',
      ],
      'entity_type' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'bundle' => [
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
      ],
      'entity_id' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The entity id this data is attached to',
      ],
      'revision_id' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => FALSE,
        'description' => 'The entity revision id this data is attached to, or NULL if the entity type is not versioned',
      ],
      'minisite_field_name' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'minisite_fid' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The minisite fid this data is attached to',
      ],
      'language' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
        'description' => 'The language for this data item.',
      ],
      'source' => [
        'description' => 'The minisite file source path.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'alias' => [
        'description' => 'The alias for this path; e.g. title-of-the-minisite.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ],
      'alias_status' => [
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'mid',
      'entity_type',
      'entity_id',
      'minisite_field_name',
      'minisite_fid',
      'language',
      'source',
    ],
    'indexes' => [
      'mid' => [
        'mid',
      ],
      'entity_type' => [
        'entity_type',
      ],
      'bundle' => [
        'bundle',
      ],
      'entity_id' => [
        'entity_id',
      ],
      'revision_id' => [
        'revision_id',
      ],
      'minisite_field_name' => [
        'minisite_field_name',
      ],
      'minisite_fid' => [
        'minisite_fid',
      ],
      'language' => [
        'language',
      ],
      'source' => [
        'source',
      ],
      'alias' => [
        'alias',
      ],
      'alias_status' => [
        'alias_status',
      ],
    ],
    'foreign keys' => [
      'minisite_fid' => [
        'table' => 'file_managed',
        'columns' => [
          'minisite_fid' => 'fid',
        ],
      ],
    ],
  ];
  return $schema;
}