##----------------------------------------------------------------------------------#
 # MusicMiner Web Server															#
 # Name:		source/app/sql/upgrade_1.2.0.sql									#
 # Author:		Jesse J Morrow	(jesse@jessejmorrow.com)							#
 # Created:		2010-03-04															#
 # Updated:		2010-04-05															#
 # Compat:		MySQL 5																#
 # Copyright:	Copyright 2010 Soundminer Inc.										#
 # Purpose:		Upgrade the installed MusicMiner databases.							#
 # Version:		1.1.2.15 to 1.2.1													#
 #----------------------------------------------------------------------------------##

# Create new `suggest` table
CREATE TABLE `mm_admin`.`suggest` (
  `suggest` varchar(128) NOT NULL,
  `src` INT NOT NULL,
  `key` varchar(128) NOT NULL,
  `ndx` INT NOT NULL,
  `sort` double NOT NULL,
  INDEX search(`sort`, `src`, `key`, `suggest`)
)
CHARACTER SET utf8;

# Add `suggest` to `site` table
ALTER TABLE `mm_admin`.`site` ADD COLUMN `suggest` BOOL NOT NULL DEFAULT 1 COMMENT 'Enable Search Suggest.' AFTER `reset_sort`;

# Set default BASE setting for `u_emailable` to allow emailing playlists
UPDATE `mm_admin`.`settings` SET `u_emailable` = NULL WHERE `id` = 2;

#-----------------------------------------------------------------------------
# Versions
#-----------------------------------------------------------------------------

# Update version fields
UPDATE `mm_admin`.`schema` SET `db_ver` = '1.2.1', `sm_ver` = '1.2.1';