##----------------------------------------------------------------------------------#
 # MusicMiner Web Server															#
 # Name:		source/app/sql/upgrade_1.1.8.sql									#
 # Author:		Jesse J Morrow	(jesse@jessejmorrow.com)							#
 # Created:		2009-03-03															#
 # Updated:		2009-03-03															#
 # Compat:		MySQL 5																#
 # Copyright:	Copyright 2008 Soundminer Inc.										#
 # Purpose:		Upgrade the installed MusicMiner databases.							#
 # Version:		1.1.6.2 to 1.1.8													#
 #----------------------------------------------------------------------------------##

# Add `email_playlists` permission to `perms` table
ALTER TABLE `mm_admin`.`perms` ADD COLUMN `email_playlists` BOOL DEFAULT NULL COMMENT 'Allow user to email playlists with auditionable links.' AFTER `file_exts`;

# Deny permission to base
UPDATE `mm_admin`.`perms` SET `email_playlists` = 0 WHERE `id` = 1;

# Grant permission to Administrator user
UPDATE `mm_admin`.`users`, `mm_admin`.`perms` SET `perms`.`email_playlists` = 1 WHERE `users`.`id` = 1 AND `users`.`perm_id` = `perms`.`id`;

# Grant permission to Administrators role
UPDATE `mm_admin`.`roles`, `mm_admin`.`perms` SET `perms`.`email_playlists` = 1 WHERE `roles`.`id` = 1 AND `roles`.`perm_id` = `perms`.`id`;

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