You are here

function weight_schema in Weight 7.2

Implements hook_schema().

File

./weight.install, line 6

Code

function weight_schema() {
  $schema['weight_settings'] = array(
    'description' => 'Table for storing Weight configuration',
    'fields' => array(
      'type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
        'default' => '',
      ),
      'weight_enabled' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'weight_range' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 20,
      ),
      'menu_weight' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'weight_default' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
      'sync_translations' => array(
        'type' => 'int',
        'size' => 'tiny',
        'unsigned' => FALSE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'type',
    ),
    'foreign keys' => array(
      'node_type' => array(
        'table' => 'node_type',
        'columns' => array(
          'type' => 'type',
        ),
      ),
    ),
  );
  $schema['weight_weights'] = array(
    'fields' => array(
      'entity_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'entity_type' => array(
        'type' => 'varchar',
        'length' => 32,
        'not null' => TRUE,
      ),
      'weight' => array(
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'entity_id',
    ),
  );
  return $schema;
}