ALTER TABLE `exercise_type`
	ADD COLUMN `tree_id` INT(12) DEFAULT 0 AFTER `exercise_type_id`;
	ADD COLUMN `active` TINYINT(1) NULL DEFAULT NULL AFTER `unit_quantity_unit`;
ALTER TABLE `exercise_type`
	DROP COLUMN `video`;

CREATE TABLE `exercise_type_image` (
	`image_id` INT(13) NOT NULL AUTO_INCREMENT,
	`exercise_type_id` INT(13) NULL DEFAULT '0',
	`name` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`url` CHAR(200) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`type` ENUM('menu','image','video') NULL DEFAULT 'image' COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`image_id`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `exercise_type_translation` (
	`translation_id` INT(13) NOT NULL AUTO_INCREMENT,
	`language_code` CHAR(2) NOT NULL DEFAULT 'en' COLLATE 'utf8mb4_general_ci',
	`exercise_type_id` INT(13) NOT NULL DEFAULT '0',
	`name` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`description` MEDIUMTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`translation_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `exercise_tree` (
	`item_id` INT(11) NOT NULL AUTO_INCREMENT,
	`parent_id` INT(11) NOT NULL DEFAULT '0',
	`name` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`image_url` CHAR(200) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`active` TINYINT(1) NULL DEFAULT '1',
	PRIMARY KEY (`item_id`) USING BTREE,
	INDEX `parent_id` (`parent_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `exercise_tree_translation` (
	`translation_id` INT(13) NOT NULL AUTO_INCREMENT,
	`tree_id` INT(13) NOT NULL DEFAULT '0',
	`language_code` CHAR(2) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`name` CHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`translation_id`) USING BTREE,
	INDEX `tree_id` (`tree_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
;

CREATE TABLE `exercise_plan` (
	`exercise_plan_id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` CHAR(50) NULL DEFAULT '0' COLLATE 'utf8mb4_general_ci',
	`description` TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`exercise_plan_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=5
;

CREATE TABLE `exercise_plan_detail` (
	`exercise_plan_detail_id` INT(11) NOT NULL AUTO_INCREMENT,
	`exercise_plan_id` INT(11) NOT NULL DEFAULT '0',
	`exercise_type_id` INT(11) NOT NULL DEFAULT '0',
	`serie` INT(11) NOT NULL DEFAULT '0',
	`repeat` INT(11) NULL DEFAULT NULL,
	`weight_equation` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	PRIMARY KEY (`exercise_plan_detail_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=4
;

CREATE TABLE `exercise_plan_translation` (
	`translation_id` INT(11) NOT NULL AUTO_INCREMENT,
	`language_code` CHAR(2) NOT NULL DEFAULT '0' COLLATE 'utf8mb4_general_ci',
	`name` CHAR(50) NULL DEFAULT '0' COLLATE 'utf8mb4_general_ci',
	`description` TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`exercise_plan_id` INT(11) NULL DEFAULT NULL,
	PRIMARY KEY (`translation_id`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=3
;

