START TRANSACTION;

ALTER TABLE `customer_training_plan`
	ADD COLUMN `active` TINYINT(1) NULL DEFAULT '0' AFTER `date_add`,
	ADD COLUMN `status` CHAR(50) NULL DEFAULT NULL AFTER `active`;

CREATE TABLE `customer_training_plan_exercise` (
	`customer_training_plan_exercise_id` INT(11) NOT NULL AUTO_INCREMENT,
	`customer_training_plan_details_id` INT(11) NOT NULL DEFAULT '0',
	`customer_id` INT NOT NULL,
	`exercise_id` INT(11) NOT NULL DEFAULT '0',
	`repeats` INT(11) NOT NULL DEFAULT '0',
	`weight` DOUBLE NOT NULL DEFAULT '0',
	PRIMARY KEY (`customer_training_plan_exercise_id`) USING BTREE,
	INDEX `customer_id` (`customer_id`)
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

CREATE TABLE `customer_training_plan_details` (
	`customer_training_plan_details_id` INT(11) NOT NULL AUTO_INCREMENT,
	`customer_training_plan_id` INT(11) NOT NULL,
	`exercise_type_id` INT(11) NOT NULL,
	`set` INT(11) NOT NULL,
	`repeats` INT(11) NOT NULL,
	`weight` DOUBLE NOT NULL DEFAULT '0',
	PRIMARY KEY (`customer_training_plan_details_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

UPDATE configuration set config_value = "1.0.41", date_change=CURRENT_DATE WHERE config_key = "db_version";

COMMIT;