You are here

function uc_product_kit_schema in Ubercart 8.4

Same name and namespace in other branches
  1. 6.2 uc_product_kit/uc_product_kit.install \uc_product_kit_schema()
  2. 7.3 uc_product_kit/uc_product_kit.install \uc_product_kit_schema()

Implements hook_schema().

File

uc_product_kit/uc_product_kit.install, line 11
Install, update and uninstall functions for the uc_product_kit module.

Code

function uc_product_kit_schema() {
  $schema['uc_product_kits'] = [
    'description' => 'Stores product kit information.',
    'fields' => [
      'vid' => [
        'description' => 'The {node}.vid of the product kit.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'nid' => [
        'description' => 'The {node}.nid of the product kit.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'product_id' => [
        'description' => 'The {uc_products}.nid of a product contained in the kit.',
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'mutable' => [
        'description' => 'A flag indicating whether the contents of the kit can be changed by the customer. 1 => Mutable. 0 => Immutable.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
      'qty' => [
        'description' => 'The number of this product contained in the kit.',
        'type' => 'int',
        'size' => 'small',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ],
      'discount' => [
        'description' => 'The adjustment to the price of the product.',
        'type' => 'float',
        'not null' => TRUE,
        'default' => 0.0,
      ],
      'ordering' => [
        'description' => 'The weight of this product in relation to other products in the kit.',
        'type' => 'int',
        'size' => 'small',
        'not null' => TRUE,
        'default' => 0,
      ],
      'synchronized' => [
        'description' => 'A flag indicating that changes to the price of this product will change the total price of the kit. 1 => Yes. 0 => No.',
        'type' => 'int',
        'size' => 'tiny',
        'not null' => TRUE,
        'default' => 0,
      ],
    ],
    'primary key' => [
      'vid',
      'product_id',
    ],
    'foreign keys' => [
      'node' => [
        'table' => 'node',
        'columns' => [
          'nid' => 'nid',
          'vid' => 'vid',
        ],
      ],
      'uc_products' => [
        'table' => 'uc_products',
        'columns' => [
          'product_id' => 'nid',
        ],
      ],
    ],
  ];
  return $schema;
}