##----------------------------------------------------------------------------------#
 # MusicMiner Web Server															#
 # Name:		source/app/sql/upgrade_1-1-0_to_1-1-1.sql							#
 # Author:		Jesse J Morrow	(jesse@jessejmorrow.com)							#
 # Created:		2008-10-15															#
 # Updated:		2008-12-02															#
 # Compat:		MySQL 5																#
 # Copyright:	Copyright 2008 Soundminer Inc.										#
 # Purpose:		Upgrade the installed MusicMiner databases.							#
 # Version:		1.1.0 to 1.1.1														#
 #----------------------------------------------------------------------------------##

# Add server-side share download options to `sites` table, add `all_sources` and `reset_sort` options
ALTER TABLE `mm_admin`.`site`
 ADD COLUMN `down_push` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Enable server-side share option.' AFTER `cue_footer`,
 ADD COLUMN `down_push_path` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Server-side share path.' AFTER `down_push`,
 ADD COLUMN `all_sources` TINYINT(1) NOT NULL DEFAULT 1 COMMENT 'Enable All Sources search option.' AFTER `down_push_path`,
 ADD COLUMN `reset_sort` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Reset user\'s sort order on new search.' AFTER `all_sources`;

# Add 'push' option to `download_zip` methods
ALTER TABLE `mm_admin`.`users` MODIFY COLUMN `download_zip` ENUM('never','folders','multiple','always','push') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'multiple' COMMENT 'Zip up multiple track downloads into a single zip file.';

# Correct misnamed group shared folders
UPDATE `mm_admin`.`groups`, `mm_admin`.`folders` SET `folders`.`name` = `groups`.`name` WHERE `groups`.`folder_id` = `folders`.`id`;

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