

ALTER TABLE `was_item_category_training`
ADD COLUMN `series_id` int(11) UNSIGNED NOT NULL after `item_category_id`,
ADD KEY `idx_series_id` (`series_id`),
DROP COLUMN `training_user_id`,
DROP COLUMN `training_title`,
DROP COLUMN `training_description`;

DROP TABLE `was_item_category_training_lesson`;

DROP TABLE `was_item_category_training_lesson_user`;

CREATE TABLE `was_item_category_training_tracking` (
  `item_category_training_tracking_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `class_id` int(11) unsigned NOT NULL,
  `user_id` int(11) unsigned NOT NULL,
  `insert_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `update_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`item_category_training_tracking_id`),
  KEY `idx_class_id` (`class_id`),
  KEY `idx_user_id` (`user_id`)
) ENGINE=InnoDB;

CREATE TRIGGER `was_item_category_training_tracking_insert_timestamp` BEFORE INSERT ON `was_item_category_training_tracking` FOR EACH ROW SET NEW.insert_timestamp = NOW();
