You are here

function commerce_tax_ui_schema in Commerce Core 7

Implements hook_schema().

File

modules/tax/commerce_tax_ui.install, line 33

Code

function commerce_tax_ui_schema() {
  $schema = array();
  $schema['commerce_tax_type'] = array(
    'description' => 'Stores information about tax types created via Tax UI.',
    'fields' => array(
      'name' => array(
        'description' => 'The machine-name of this type.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The administrative title of this type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'display_title' => array(
        'description' => 'The front end display title of this type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'A brief description of this type.',
        'type' => 'text',
        'size' => 'medium',
        'not null' => FALSE,
      ),
      'display_inclusive' => array(
        'description' => 'Boolean indicating whether or not taxes of this type display inclusively in product prices.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'round_mode' => array(
        'description' => 'Integer indicating what type of rounding (if any) should be done for taxes of this type.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'module' => array(
        'description' => 'The name of the module that defines this tax type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'name',
    ),
  );
  $schema['commerce_tax_rate'] = array(
    'description' => 'Stores information about tax rates created via Tax UI.',
    'fields' => array(
      'name' => array(
        'description' => 'The machine-name of this rate.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'title' => array(
        'description' => 'The administrative title of this rate.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'display_title' => array(
        'description' => 'The front end display title of this rate.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
      'description' => array(
        'description' => 'A brief description of this rate.',
        'type' => 'text',
        'size' => 'medium',
        'not null' => FALSE,
      ),
      'rate' => array(
        'description' => 'The percentage used to calculate this tax expressed as a decimal.',
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '0',
      ),
      'type' => array(
        'description' => "The machine-name of the rate's {commerce_tax_type}.",
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
        'default' => '',
      ),
      'default_rules_component' => array(
        'description' => 'Boolean indicating whether or not this rate should have a default Rules component for applying it to products.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ),
      'module' => array(
        'description' => 'The name of the module that defines this tax type.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'name',
    ),
    'indexes' => array(
      'type' => array(
        'type',
      ),
    ),
    'foreign keys' => array(
      'tax_type' => array(
        'table' => 'commerce_tax_type',
        'columns' => array(
          'type' => 'name',
        ),
      ),
    ),
  );
  return $schema;
}