You are here

function draggableviews_schema in DraggableViews 2.0.x

Same name and namespace in other branches
  1. 8 draggableviews.install \draggableviews_schema()
  2. 6.3 draggableviews.install \draggableviews_schema()
  3. 6 draggableviews.install \draggableviews_schema()
  4. 6.2 draggableviews.install \draggableviews_schema()
  5. 7.2 draggableviews.install \draggableviews_schema()
  6. 7 draggableviews.install \draggableviews_schema()

Implements hook_schema().

File

./draggableviews.install, line 13
Install, update and uninstall functions for the draggableviews module.

Code

function draggableviews_schema() {
  $schema['draggableviews_structure'] = [
    'description' => 'Saves the order settings of a draggableview view.',
    'fields' => [
      'dvid' => [
        'type' => 'serial',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'The primary identifier.',
      ],
      'view_name' => [
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Makes the order unique for each view.',
      ],
      'view_display' => [
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
        'description' => 'Makes the order unique for each view display.',
      ],
      'args' => [
        'type' => 'varchar',
        'length' => 255,
        'not null' => FALSE,
        'default' => '',
        'description' => 'Makes the order unique for a given set of arguments',
      ],
      'entity_id' => [
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'description' => 'Id of the entity that we are sorting (node, user, etc.).',
      ],
      'weight' => [
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The order weight.',
      ],
      'parent' => [
        'type' => 'int',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The id of the parent.',
      ],
    ],
    'indexes' => [
      'view' => [
        'view_name',
        'view_display',
        'args',
        'entity_id',
      ],
      'weight' => [
        'weight',
      ],
      'entity_id' => [
        'entity_id',
      ],
    ],
    'primary key' => [
      'dvid',
    ],
  ];
  return $schema;
}