##----------------------------------------------------------------------------------#
 # MusicMiner Web Server															#
 # Name:		source/app/sql/upgrade_1.1.5.sql									#
 # Author:		Jesse J Morrow	(jesse@jessejmorrow.com)							#
 # Created:		2008-12-13															#
 # Updated:		2008-12-27															#
 # Compat:		MySQL 5																#
 # Copyright:	Copyright 2008 Soundminer Inc.										#
 # Purpose:		Upgrade the installed MusicMiner databases.							#
 # Version:		1.1.4 to 1.1.5														#
 #----------------------------------------------------------------------------------##

# Correct `schema` fields for databases that were installed with name suffixes
UPDATE `mm_admin`.`schema` SET `schema` = 'mm_admin';
UPDATE `mm_cache`.`schema` SET `schema` = 'mm_cache';

# Add `link` field to `columns` table
ALTER TABLE `mm_admin`.`columns` ADD COLUMN `link` ENUM('none','field','word') DEFAULT 'field' COMMENT 'Type of live link to use for this column.' AFTER `context`;
UPDATE `mm_admin`.`columns` SET `link` = 'word' WHERE `id` IN ('Description','Keywords','Lyrics','BWDescription','CDDescription');
UPDATE `mm_admin`.`columns` SET `link` = NULL WHERE `id` IN ('Relevance','_WaveformLink','_PictureLink','_UMID','Artwork','Waveform','CueNo','CueTime','CueUsage');

# Add `album_volume` to `site` table
ALTER TABLE `mm_admin`.`site` ADD COLUMN `album_volume` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Display Volume field under album covers.' AFTER `metadata_order`;

# Update version fields
UPDATE `mm_admin`.`schema` SET `db_ver` = '1.1.5';