You are here

function commerce_purchase_order_schema in Commerce Purchase Order 7

Implements hook_schema().

File

./commerce_purchase_order.install, line 16

Code

function commerce_purchase_order_schema() {
  $schema = array();
  $schema['commerce_purchase_order'] = array(
    'description' => 'The base table for PO numbers.',
    'fields' => array(
      'order_id' => array(
        'description' => 'The order id.',
        'type' => 'int',
        'not null' => TRUE,
        'default' => 0,
      ),
      'transaction_id' => array(
        'description' => 'The {commerce_payment_transaction}.transaction_id.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'po_number' => array(
        'description' => 'The PO number.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
    ),
    'unique keys' => array(
      'order_po' => array(
        'order_id',
        'po_number',
      ),
    ),
    'primary key' => array(
      'transaction_id',
    ),
  );
  return $schema;
}