##----------------------------------------------------------------------------------#
 # MusicMiner Web Server															#
 # Name:		source/app/sql/upgrade_0-5-2_to_0-5-3.sql							#
 # Author:		Jesse J Morrow	(jesse@jessejmorrow.com)							#
 # Created:		2007-05-08															#
 # Updated:		2007-05-08															#
 # Compat:		MySQL 5																#
 # Copyright:	Copyright 2007 Soundminer Inc.										#
 # Purpose:		Upgrade the installed MusicMiner databases.							#
 # Version:		0.5.2 to 0.5.3														#
 #----------------------------------------------------------------------------------##

ALTER TABLE `mm_admin`.`proxies` MODIFY COLUMN `mime_name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'From Metadata' COMMENT '\'From Metadata\' = use type given in `metadata` table row';
UPDATE `mm_admin`.`proxies` SET `mime_name` = 'From Metadata' WHERE `mime_name` = '';

ALTER TABLE `mm_admin`.`schema`
  CHANGE COLUMN `database_version` `db_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  CHANGE COLUMN `software_version` `mm_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  ADD COLUMN `sm_ver` VARCHAR(30) NOT NULL AFTER `mm_ver`;

ALTER TABLE `mm_cache`.`schema`
  CHANGE COLUMN `database_version` `db_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  CHANGE COLUMN `software_version` `mm_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

ALTER TABLE `mm_logs`.`schema`
  CHANGE COLUMN `database_version` `db_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  CHANGE COLUMN `software_version` `mm_ver` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

UPDATE `mm_admin`.`schema` SET `db_ver` = '0.5.3', `mm_ver` = '0.5.3', `sm_ver` = '0.5.3';
UPDATE `mm_cache`.`schema` SET `db_ver` = '0.5.3', `mm_ver` = '0.5.3';
UPDATE `mm_logs`.`schema` SET `db_ver` = '0.5.3', `mm_ver` = '0.5.3';