# Linea21 DB patch - UTF-8 format
# patch v1.4.x To v1.5


# ************** Warning **************
# If you use linea version < 1.2 apply first, patch_1.2.mysql.xx.sql, then patch_1.3.mysql.sql and patch_1.4.mysql.sql !!!
#
# USE linea;

ALTER TABLE `l21_profile` ADD `profile_firstname` VARCHAR( 200 ) NOT NULL default '' AFTER `profile_id`, ADD `profile_lastname` VARCHAR( 200 ) NOT NULL default '' AFTER `profile_firstname`;

ALTER TABLE `l21_workshop_com` CHANGE `workcom_last_modify` `workcom_last_modify` TIMESTAMP NOT NULL;

ALTER TABLE `l21_project` ADD `project_completed` INT NOT NULL DEFAULT '0' AFTER `project_end_date`;

ALTER TABLE `l21_yellowpages` ADD `yellowp_latitude` FLOAT NOT NULL DEFAULT '0' AFTER `yellowp_website` , ADD `yellowp_longitude` FLOAT NOT NULL DEFAULT '0' AFTER `yellowp_latitude`; 

# Adding '*_range' to tables
ALTER TABLE `l21_workshop` ADD `workshop_range` INT NOT NULL DEFAULT '0' AFTER `workshop_level`;
ALTER TABLE `l21_publication` ADD `publi_range` INT NOT NULL DEFAULT '0' AFTER `publi_level`;
ALTER TABLE `l21_project` ADD `project_range` INT NOT NULL DEFAULT '0' AFTER `project_completed`;
ALTER TABLE `l21_scale` ADD `scale_range` INT NOT NULL DEFAULT '0' AFTER `scale_dependencies` ;
ALTER TABLE `l21_workshop_report_contents` ADD `workrepcon_range` INT NOT NULL DEFAULT '0' AFTER `workrepcon_body`;
ALTER TABLE `l21_publication_contents` ADD `publicon_range` INT NOT NULL DEFAULT '0' AFTER `publicon_photos_uri`;


ALTER TABLE `l21_sdi_value` ADD `sdiv_comment` TEXT NOT NULL AFTER `sdiv_value` ;
ALTER TABLE `l21_sdi_value` ADD `sdiv_comment_display` VARCHAR( 1 ) NOT NULL DEFAULT 'N' AFTER `sdiv_comment` ;
-- 
-- Creating the **Comment** table
--
DROP TABLE IF EXISTS `l21_comment`;
CREATE TABLE IF NOT EXISTS `l21_comment` (  `comment_id` int NOT NULL AUTO_INCREMENT,  `comment_module` varchar(100) NOT NULL,  `comment_module_id` varchar(255) NOT NULL,  `comment_user_id` int NOT NULL,  `comment_name` varchar(255) NOT NULL,  `comment_email` varchar(255) NOT NULL,  `comment_url` varchar(255) NOT NULL,  `comment_body` text NOT NULL,  `comment_notification` varchar(1) NOT NULL,  `comment_date_crea` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',  `comment_last_modify` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,  `comment_status` enum('D','P','E') NOT NULL DEFAULT 'D',  PRIMARY KEY (`comment_id`),  FULLTEXT KEY `comment_index` (`comment_name`,`comment_email`,`comment_body`)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci ;
-- 
-- Creating the **Workshop_notify_exception** table
--
CREATE TABLE `l21_workshop_notify_exception` (`workshop_id` INT NOT NULL ,`user_id` INT NOT NULL ,`type` VARCHAR( 100 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL) CHARSET=utf8 COLLATE utf8_general_ci ;

-- 
-- Removing old templates stuff
--
ALTER TABLE `l21_news`  DROP `news_template`,  DROP `news_photo_uri`;

ALTER TABLE `l21_publication_contents`  DROP `publicon_template`,  DROP `publicon_photos_uri`;


