You are here

function draggableviews_schema in DraggableViews 7.2

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 draggableviews.install \draggableviews_schema()
  6. 2.0.x draggableviews.install \draggableviews_schema()

Implements hook_schema().

File

./draggableviews.install, line 12
Draggableviews defines a new database schema for saving the order.

Code

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