You are here

amazon_media.install in Amazon Product Advertisement API 7

Install, update and uninstall functions for the amazon_media module.

File

amazon_media/amazon_media.install
View source
<?php

/**
 * @file
 * Install, update and uninstall functions for the amazon_media module.
 *
 */
function amazon_media_install() {
  amazon_media_update_7002();

  // Set system weight.
}
function amazon_media_uninstall() {
}
function amazon_media_schema() {
  $schema['amazon_book'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'ean' => array(
        'type' => 'varchar',
        'length' => 20,
      ),
      'isbn' => array(
        'type' => 'varchar',
        'length' => 20,
        'not null' => TRUE,
      ),
      'deweydecimalnumber' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'edition' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'numberofpages' => array(
        'type' => 'int',
      ),
      'publicationdate' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
    ),
    'primary key' => array(
      'asin',
    ),
  );
  $schema['amazon_dvd'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'regioncode' => array(
        'type' => 'int',
      ),
      'runningtime' => array(
        'type' => 'int',
      ),
      'audiencerating' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'aspectratio' => array(
        'type' => 'varchar',
        'length' => 16,
      ),
    ),
    'primary key' => array(
      'asin',
    ),
  );
  $schema['amazon_music'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'artist' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'label' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'studio' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
      'numberofdiscs' => array(
        'type' => 'int',
        'default' => 1,
      ),
    ),
    'primary key' => array(
      'asin',
    ),
  );
  $schema['amazon_software'] = array(
    'fields' => array(
      'asin' => array(
        'type' => 'varchar',
        'length' => 64,
        'not null' => TRUE,
      ),
      'esrbagerating' => array(
        'type' => 'varchar',
        'length' => 32,
      ),
      'operatingsystem' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'hardwareplatform' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'platform' => array(
        'type' => 'varchar',
        'length' => 64,
      ),
      'genre' => array(
        'type' => 'varchar',
        'length' => 128,
      ),
    ),
    'primary key' => array(
      'asin',
    ),
  );
  return $schema;
}

/**
 * Set the weight on amazon_media to be higher than amazon.
 *
 * This allows amazon_media to override theme settings that amazon has done.
 */
function amazon_media_update_7002() {
  db_query("UPDATE {system} SET weight = 10 WHERE name = 'amazon_media'");
}

/**
 * Update the "edition" field to a varchar since it can be many things provided
 * by amazon.
 */
function amazon_media_update_7003() {
  db_change_field('amazon_book', 'edition', 'edition', array(
    'type' => 'varchar',
    'length' => 128,
  ));
  return t("Changed amazon_book 'edition' to a varchar");
}

/**
 * Remove the Theatrical Release Date as Amazon no longer supports it.
 */
function amazon_media_update_7004() {
  db_drop_field('amazon_dvd', 'theatricalreleasedate');
}

/**
 * Amazon seems not to require or always provide EAN.
 */
function amazon_media_update_7005() {
  db_change_field('amazon_book', 'ean', 'ean', array(
    'type' => 'varchar',
    'length' => 20,
  ));
}

Functions

Namesort descending Description
amazon_media_install @file Install, update and uninstall functions for the amazon_media module.
amazon_media_schema
amazon_media_uninstall
amazon_media_update_7002 Set the weight on amazon_media to be higher than amazon.
amazon_media_update_7003 Update the "edition" field to a varchar since it can be many things provided by amazon.
amazon_media_update_7004 Remove the Theatrical Release Date as Amazon no longer supports it.
amazon_media_update_7005 Amazon seems not to require or always provide EAN.