You are here

function minisite_schema in Mini site 8

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

Implements hook_schema().

File

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

Code

function minisite_schema() {
  $schema['minisite_asset'] = [
    'description' => 'Asset information for minisite.',
    'fields' => [
      'id' => [
        'description' => 'The primary identifier for a minisite asset',
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ],
      'entity_type' => [
        'description' => 'The entity type of that entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'entity_bundle' => [
        'description' => 'The type of this entity.',
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'entity_id' => [
        'description' => 'The entity id this data is attached to',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'entity_language' => [
        'description' => 'The {language}.langcode of this entity.',
        'type' => 'varchar_ascii',
        'length' => 12,
        'not null' => TRUE,
        'default' => '',
      ],
      'field_name' => [
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ],
      'source' => [
        'description' => 'The URI of the source asset file.',
        'type' => 'varchar',
        'length' => 2048,
        'not null' => TRUE,
        'default' => '',
      ],
      'alias' => [
        'description' => 'The alias for the asset path.',
        'type' => 'varchar',
        'length' => 2048,
        'not null' => FALSE,
        'default' => '',
      ],
      'filemime' => [
        'description' => 'The file MIME of the asset.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => NULL,
      ],
      'filesize' => [
        'description' => 'The file size of the asset.',
        'type' => 'int',
        'size' => 'big',
        'length' => 20,
        'unsigned' => TRUE,
        'not null' => FALSE,
        'default' => NULL,
      ],
    ],
    'primary key' => [
      'id',
    ],
    'unique keys' => [
      'id' => [
        'id',
        'entity_type',
        'entity_bundle',
        'entity_id',
        'entity_language',
        'field_name',
      ],
    ],
    'indexes' => [
      'source' => [
        [
          'source',
          170,
        ],
      ],
      'alias' => [
        [
          'alias',
          170,
        ],
      ],
    ],
  ];
  return $schema;
}