t('Information about albums in the station catalog.'), 'fields' => array( 'nid' => array( 'description' => t("The album's {node}.nid."), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'number' => array( 'description' => t('The catalog number.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, ), 'artist' => array( 'description' => t('Name of the artist.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'album' => array( 'description' => t('Name of the album.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'year' => array( 'description' => t('Year the album was released.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, ), 'label' => array( 'description' => t('Name of the label that released the album.'), 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'mb_release_id' => array( 'description' => t('MusicBrainz release id for the album.'), 'type' => 'varchar', 'length' => 36, 'not null' => TRUE, 'default' => '', ), 'asin' => array( 'description' => t('Amazon product id..'), 'type' => 'varchar', 'length' => 16, 'not null' => TRUE, 'default' => '', ), ), 'indexes' => array( 'station_catalog_artist' => array('artist'), 'station_catalog_album' => array('album'), 'station_catalog_year' => array('year'), 'station_catalog_label' => array('label'), 'mb_release' => array('mb_release_id'), ), 'unique keys' => array( 'station_catalog_number' => array('number') ), 'primary key' => array('nid'), ); return $schema; } /** * Remove the autonumber from the nid column and add a year column. */ function station_catalog_update_5200() { $ret = array(); switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {station_catalog} MODIFY COLUMN `nid` INTEGER UNSIGNED NOT NULL DEFAULT 0; "); $ret[] = update_sql("ALTER TABLE {station_catalog} ADD COLUMN `year` INTEGER UNSIGNED NOT NULL AFTER `album`, ADD INDEX station_catalog_year(`year`); "); break; } return $ret; } /** * Add MusicBrainz release id field and Amazon ASIN field. */ function station_catalog_update_5201() { $ret = array(); switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': $ret[] = update_sql("ALTER TABLE {station_catalog} ADD COLUMN `mb_release_id` VARCHAR(36) NOT NULL DEFAULT '' AFTER `label`, ADD INDEX mb_release(`mb_release_id`); "); $ret[] = update_sql("ALTER TABLE {station_catalog} ADD COLUMN `asin` varchar(16) NOT NULL default '' AFTER `mb_release_id`; "); break; } return $ret; } /** * Rename some incorrectly named variables. */ function station_catalog_update_5202() { if ($val = variable_get('station_category_vocabulary', FALSE)) { variable_set('station_catalog_vocabulary', $val); } if ($val = variable_get('station_category_redirect_on_add', FALSE)) { variable_set('station_catalog_redirect_on_add', $val); } variable_del('station_category_vocabulary'); variable_del('station_category_redirect_on_add'); return array(); } /** * Implementation of hook_update_last_removed(). */ function station_catalog_update_last_removed() { // We've removed the 5.x-1.x version of the module, including database // updates. The next update function is 5200. return 101; }