You are here

function uc_field_attribute_schema in Ubercart Field attributes 7

Implements hook_schema().

File

./uc_field_attribute.install, line 17
Install, update and uninstall functions for the UC Field Attribute module.

Code

function uc_field_attribute_schema() {
  $schema['uc_field_attribute_node'] = array(
    'description' => 'Stores which attribute belongs to which node and is maintained by us.',
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Primary Key: The {uc_attribute}.aid.',
      ),
      'nid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {node}.nid of the product.',
      ),
      'field_instance_id' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {field_instance_config}.id.',
      ),
    ),
    'primary key' => array(
      'aid',
    ),
    ///TODO
    'indexes' => array(
      'nid-field_instance_id' => array(
        'nid',
        'field_instance_id',
      ),
    ),
  );
  $schema['uc_field_attribute_options'] = array(
    'description' => 'Stores options for synchronisation.',
    'fields' => array(
      'aid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'Primary Key: The {uc_attribute}.aid.',
      ),
      'oid' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
        'description' => 'The {uc_attribute_options}.oid.',
      ),
      'name' => array(
        'description' => 'The name of the option.',
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'default' => '',
      ),
    ),
    'primary key' => array(
      'aid',
      'oid',
    ),
    ///TODO
    'indexes' => array(
      'aid' => array(
        'aid',
      ),
    ),
  );
  return $schema;
}