# Linea21 DB patch - UTF-8 format
# patch v1.6.x To v1.7


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


# adding the ability to create homepage from page module
ALTER TABLE `l21_page` ADD `page_homepage` VARCHAR( 1 ) NOT NULL DEFAULT 'N' AFTER `page_parent_id` ;

# adding "remember me" ability to login page
ALTER TABLE `l21_user` ADD `user_cookiehash` VARCHAR( 50 ) NOT NULL DEFAULT '' AFTER `user_forget_passkey`;
ALTER TABLE `l21_user` ADD `user_old_logins` VARCHAR( 255 ) NOT NULL DEFAULT '' AFTER `user_cookiehash`;

# change login field value to 50 char
ALTER TABLE `l21_user` CHANGE `user_login` `user_login` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ;

# adding "fields" to project
ALTER TABLE `l21_project` ADD `project_budget` INT DEFAULT NULL AFTER `project_body`;

# adding l21_actor table + join tables
CREATE TABLE `l21_actor` (`actor_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,`actor_name` VARCHAR( 255 ) NOT NULL) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;
CREATE TABLE `l21_j_project_actor` (  `jpa_id` int NOT NULL AUTO_INCREMENT,  `jpa_project_id` int NOT NULL,  `jpa_actor_id` int NOT NULL,  `jpa_type` varchar(50) NOT NULL,  PRIMARY KEY (`jpa_id`)) DEFAULT CHARSET=utf8 COLLATE utf8_general_ci;

# adding restriction ability on group
ALTER TABLE `l21_workshop` ADD `workshop_restricted` INT NOT NULL DEFAULT '0' AFTER `workshop_level` ;
