You are here

function physical_field_schema in Physical Fields 7

Implements hook_field_schema().

File

./physical.install, line 6

Code

function physical_field_schema($field) {
  if ($field['type'] == 'physical_volume') {
    return array(
      'columns' => array(
        'volume' => array(
          'description' => 'The numeric volume value.',
          'type' => 'numeric',
          'size' => 'normal',
          'not null' => TRUE,
          'default' => 0,
          'precision' => 15,
          'scale' => 5,
        ),
        'unit' => array(
          'description' => 'The unit of measurement.',
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'indexes' => array(
        'volume' => array(
          'volume',
        ),
      ),
    );
  }
  if ($field['type'] == 'physical_weight') {
    return array(
      'columns' => array(
        'weight' => array(
          'description' => 'The numeric weight value.',
          'type' => 'numeric',
          'size' => 'normal',
          'not null' => TRUE,
          'default' => 0,
          'precision' => 15,
          'scale' => 5,
        ),
        'unit' => array(
          'description' => 'The unit of measurement.',
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
        ),
      ),
      'indexes' => array(
        'weight' => array(
          'weight',
        ),
      ),
    );
  }
  if ($field['type'] == 'physical_dimensions') {
    return array(
      'columns' => array(
        'length' => array(
          'description' => 'The numeric length value.',
          'type' => 'numeric',
          'size' => 'normal',
          'default' => 0,
          'precision' => 15,
          'scale' => 5,
        ),
        'width' => array(
          'description' => 'The numeric width value.',
          'type' => 'numeric',
          'size' => 'normal',
          'default' => 0,
          'precision' => 15,
          'scale' => 5,
        ),
        'height' => array(
          'description' => 'The numeric height value.',
          'type' => 'numeric',
          'size' => 'normal',
          'default' => 0,
          'precision' => 15,
          'scale' => 5,
        ),
        'unit' => array(
          'description' => 'The unit of measurement.',
          'type' => 'varchar',
          'length' => '255',
          'not null' => TRUE,
          'default' => '',
        ),
      ),
    );
  }
}