You are here

function commerce_price_field_schema in Commerce Core 7

Implements hook_field_schema().

File

modules/price/commerce_price.install, line 98

Code

function commerce_price_field_schema($field) {
  if ($field['type'] == 'commerce_price') {
    return array(
      'columns' => array(
        'amount' => array(
          'description' => 'The price amount.',
          'type' => 'int',
          'not null' => TRUE,
          'default' => 0,
        ),
        'currency_code' => array(
          'description' => 'The currency code for the price.',
          'type' => 'varchar',
          'length' => 32,
          'not null' => TRUE,
        ),
        'data' => array(
          'description' => 'A serialized array of additional price data.',
          'type' => 'text',
          'size' => 'big',
          'not null' => FALSE,
          'serialize' => TRUE,
        ),
      ),
      'indexes' => array(
        'currency_price' => array(
          'amount',
          'currency_code',
        ),
      ),
    );
  }
}