START TRANSACTION;

CREATE TABLE `training_plan` (
	`training_plan_id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` CHAR(50) NOT NULL COLLATE 'utf8_hungarian_ci',
	`type` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	PRIMARY KEY (`training_plan_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

CREATE TABLE `training_plan_detail` (
	`training_plan_detail_id` INT(11) NOT NULL AUTO_INCREMENT,
	`training_plan_id` INT(11) NOT NULL,
	`exercise_type_id` INT(11) NOT NULL,
	`sort` INT(3) UNSIGNED ZEROFILL NULL DEFAULT NULL,
	`set` INT(3) NULL DEFAULT NULL,
	`repeats` INT(5) NULL DEFAULT NULL COMMENT '-1: max',
	`weight` DOUBLE NULL DEFAULT NULL COMMENT '-1: calculated',
	`resting_time` INT(3) NULL DEFAULT NULL,
	`parallel` TINYINT(4) NULL DEFAULT NULL,
	`day` CHAR(50) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	PRIMARY KEY (`training_plan_detail_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;


CREATE TABLE `customer_training_plan` (
	`customer_training_plan_id` INT(11) NOT NULL AUTO_INCREMENT,
	`customer_id` INT(11) NOT NULL DEFAULT '0',
	`training_plan_id` INT(11) NOT NULL DEFAULT '0',
	`date_add` DATETIME NULL DEFAULT NULL,
	PRIMARY KEY (`customer_training_plan_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

CREATE TABLE `faq` (
	`faq_id` INT(11) NOT NULL AUTO_INCREMENT,
	`name` CHAR(50) NOT NULL COLLATE 'utf8_hungarian_ci',
	`description` TEXT NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	PRIMARY KEY (`faq_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

CREATE TABLE `faq_translation` (
	`translation_id` INT(11) NOT NULL AUTO_INCREMENT,
	`faq_id` INT(11) NOT NULL DEFAULT '0',
	`name_translation` CHAR(50) NOT NULL DEFAULT '0' COLLATE 'utf8_hungarian_ci',
	`description_translation` TEXT NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	`language_code` CHAR(2) NULL DEFAULT 'en' COLLATE 'utf8_hungarian_ci',
	PRIMARY KEY (`translation_id`) USING BTREE,
	INDEX `faq_id` (`faq_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;


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

COMMIT;
