You are here

function amazon_schema in Amazon Product Advertisement API 7.2

Same name and namespace in other branches
  1. 6 amazon.install \amazon_schema()
  2. 7 amazon.install \amazon_schema()
1 call to amazon_schema()
amazon_item_insert in ./amazon.module
Insert 'cleaned' amazon item into database.

File

./amazon.install, line 59
Install, update and uninstall functions for the amazon module.

Code

function amazon_schema() {
  $schema['amazon_item'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'locale' => array(
        'type' => 'varchar',
        'length' => 2,
        'not null' => TRUE,
      ),
      'title' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'detailpageurl' => array(
        'type' => 'text',
      ),
      'salesrank' => array(
        'type' => 'int',
        'unsigned' => TRUE,
      ),
      'brand' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'publisher' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'manufacturer' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'mpn' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'studio' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'binding' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'releasedate' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'listpriceamount' => array(
        'type' => 'numeric',
        'not null' => FALSE,
        'precision' => '10',
        'scale' => '0',
      ),
      'listpricecurrencycode' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'listpriceformattedprice' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'lowestpriceamount' => array(
        'type' => 'numeric',
        'not null' => FALSE,
        'precision' => '10',
        'scale' => '0',
      ),
      'lowestpricecurrencycode' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'lowestpriceformattedprice' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'amazonpriceamount' => array(
        'type' => 'numeric',
        'not null' => FALSE,
        'precision' => '10',
        'scale' => '0',
      ),
      'amazonpricecurrencycode' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'amazonpriceformattedprice' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'productgroup' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'producttypename' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'customerreviews_iframe' => array(
        'type' => 'varchar',
        'length' => 255,
      ),
      'invalid_asin' => array(
        'type' => 'int',
        'default' => 0,
      ),
      'timestamp' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 0,
      ),
    ),
    'primary key' => array(
      'asin',
      'locale',
    ),
  );
  $schema['amazon_item_participant'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'type' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'participant' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
    ),
    'indexes' => array(
      'asin' => array(
        'asin',
      ),
    ),
  );
  $schema['amazon_item_image'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'size' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'height' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'width' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
    ),
    'primary key' => array(
      'asin',
      'size',
    ),
    'indexes' => array(
      'asin' => array(
        'asin',
      ),
    ),
  );
  $schema['amazon_item_image_gallery'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'size' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'url' => array(
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
      ),
      'height' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'width' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
      ),
      'category' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'image_order' => array(
        'type' => 'int',
        'unsigned' => TRUE,
        'not null' => TRUE,
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'asin',
      'size',
      'image_order',
    ),
    'indexes' => array(
      'asin' => array(
        'asin',
      ),
    ),
  );
  $schema['amazon_item_editorial_review'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'source' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
      ),
      'content' => array(
        'type' => 'text',
      ),
    ),
    'indexes' => array(
      'asin' => array(
        'asin',
      ),
    ),
  );
  return $schema;
}