ALTER TABLE `exercises`
ADD COLUMN `unit` ENUM('kg','meter','repeat','minute') NULL DEFAULT 'repeat' AFTER `quantity`,
CHANGE COLUMN `quantity` `quantity` FLOAT NULL DEFAULT NULL AFTER `datetime_exercise`;

ALTER TABLE `exercises`
CHANGE COLUMN `datetime_exercise` `date_add` DATETIME NOT NULL AFTER `customer_id`,
ADD INDEX `customer_id` (`customer_id`);

ALTER TABLE `customer`
	ADD COLUMN `password` CHAR(100) NULL DEFAULT NULL AFTER `email`,
	ADD COLUMN `date_add` DATETIME NULL AFTER `active`,
	ADD COLUMN `date_change` DATETIME NULL AFTER `date_add`,
	ADD COLUMN `data_policy_allowed` TINYINT NULL DEFAULT '1' AFTER `date_change`,
	ADD COLUMN `admin` TINYINT NULL DEFAULT '0' AFTER `data_policy_allowed`;

CREATE TABLE `exercise_evaluation` (
	`evaluation_id` INT(11) NOT NULL AUTO_INCREMENT,
	`age_min` INT(11) NULL DEFAULT '0',
	`age_max` INT(11) NULL DEFAULT '0',
	`value_min` INT(11) NULL DEFAULT '0',
	`value_max` INT(11) NULL DEFAULT '0',
	`sex` ENUM('m','w') NOT NULL DEFAULT 'm' COLLATE 'utf8_hungarian_ci',
    `evaluation` ENUM('excellent','very good','good','average','weak','poor') NOT NULL DEFAULT 'average' COLLATE 'utf8_hungarian_ci',
	`description` TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	PRIMARY KEY (`evaluation_id`) USING BTREE,
	INDEX `value_min_value_max` (`value_min`, `value_max`) USING BTREE,
	INDEX `age_min_age_max` (`age_min`, `age_max`) USING BTREE,
	INDEX `age_min_age_max_value_min_value_max` (`age_min`, `age_max`, `value_min`, `value_max`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

CREATE TABLE `customer_information` (
	`customer_information_id` INT(11) NOT NULL AUTO_INCREMENT,
	`title` CHAR(50) NULL DEFAULT '' COLLATE 'utf8_hungarian_ci',
	`description` TEXT(65535) NULL DEFAULT NULL COLLATE 'utf8_hungarian_ci',
	`date_add` DATETIME NULL DEFAULT NULL,
	`display_begin` DATETIME NULL DEFAULT NULL,
	`display_end` DATETIME NULL DEFAULT NULL,
	PRIMARY KEY (`customer_information_id`) USING BTREE,
	INDEX `title` (`title`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

INSERT INTO `customer_information` (`customer_information_id`, `title`, `description`, `date_add`, `display_begin`, `display_end`) VALUES (1, 'Fekvőtámasz világcsúcs', 'Világcsúcs fekvőtámasz: KJ Joseph 1 perc alatt 82 szabályos fekvőtámaszt végzett', '2020-06-01 08:00:00', '2020-06-01 08:00:00', '2023-07-01 08:00:00');
INSERT INTO `customer_information` (`customer_information_id`, `title`, `description`, `date_add`, `display_begin`, `display_end`) VALUES (2, 'Húzódszkodás csúcs', '24 órás csúcstartója Joonas Mäkipelto 5050 gyakorlattal', '2020-06-01 08:00:00', '2020-06-01 08:00:00', '2023-07-01 08:00:00');
INSERT INTO `customer_information` (`customer_information_id`, `title`, `description`, `date_add`, `display_begin`, `display_end`) VALUES (3, 'Fekvenyomás', '2015-ben a fekvenyomó világbajnokságot Smulter Fredrik finn súlyemelő 401 Kg-al nyerte', '2020-06-01 08:00:00', '2020-05-01 00:00:00', '2020-06-01 08:00:01');

DROP TABLE exercise_ages;

UPDATE configuration set config_value = "0.0.2" WHERE config_key = "db_version";

