CREATE TABLE `customer_exercise_device` (
	`customer_exercise_device_id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`customer_id` INT(11) NOT NULL DEFAULT '0',
	`exercise_device_id` INT(11) NOT NULL DEFAULT '0',
	`date_add` DATETIME NULL DEFAULT NULL,
	`favourite` TINYINT(4) NULL DEFAULT NULL,
	PRIMARY KEY (`customer_exercise_device_id`) USING BTREE
)
COLLATE='utf8_hungarian_ci'
ENGINE=InnoDB
;

INSERT INTO `customer_exercise_device` (`customer_exercise_device_id`, `customer_id`, `exercise_device_id`, `date_add`, `favourite`) VALUES (1, 90, 1, NULL, NULL);
INSERT INTO `customer_exercise_device` (`customer_exercise_device_id`, `customer_id`, `exercise_device_id`, `date_add`, `favourite`) VALUES (2, 90, 2, NULL, NULL);

ALTER TABLE `exercise_device`
	CHANGE COLUMN `device_id` `exercise_device_id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
	DROP PRIMARY KEY,
	ADD PRIMARY KEY (`exercise_device_id`) USING BTREE;

ALTER TABLE `exercise_device_translation`
	CHANGE COLUMN `device_id` `exercise_device_id` INT(11) NULL DEFAULT NULL AFTER `translation_id`;

ALTER TABLE `exercise_device_translation`
	ADD INDEX `exercise_device_id` (`exercise_device_id`);

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