CREATE TABLE `my_db_name`.`_my_table_name_new` (
  `my_table_name_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `tour_id` int(11) unsigned NOT NULL,
  `status` enum('new','pending','approved','rejected','deleted') NOT NULL DEFAULT 'new',
  `fields` varchar(600) NOT NULL,
  `comment` text NOT NULL,
  `reject_reasons` varchar(500) DEFAULT NULL,
  `reject_text` varchar(1000) DEFAULT NULL,
  `creation_timestamp` datetime NOT NULL,
  `requester_user_type` enum('staff','supplier') DEFAULT NULL,
  `update_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `update_user_type` enum('staff','supplier','reseller','customer','cron_job') DEFAULT NULL,
  `update_user_id` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`my_table_name_id`),
  KEY `tour_id_status` (`tour_id`,`status`)
) ENGINE=InnoDB AUTO_INCREMENT=483132 DEFAULT CHARSET=utf8 COMMENT='5.6' ;

ALTER TABLE `my_db_name`.`_my_table_name_new` ADD COLUMN approve_text TEXT AFTER reject_text;


CREATE TABLE `my_db_name`.`_my_table_name_new` (
    `my_table_name_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `tour_id` int(11) unsigned NOT NULL,
    `status` enum('new','pending','approved','rejected','deleted') NOT NULL DEFAULT 'new',
    `fields` varchar(600) NOT NULL,
    `comment` text NOT NULL,
    `reject_reasons` varchar(500) DEFAULT NULL,
    `reject_text` varchar(1000) DEFAULT NULL,
    `creation_timestamp` datetime NOT NULL,
    `requester_user_type` enum('staff','supplier') DEFAULT NULL,
    `update_timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    `update_user_type` enum('staff','supplier','reseller','customer','cron_job') DEFAULT NULL,
    `update_user_id` int(10) unsigned DEFAULT NULL,
    PRIMARY KEY (`my_table_name_id`),
    KEY `tour_id_status` (`tour_id`,`status`)
    ) ENGINE=InnoDB AUTO_INCREMENT=483132 DEFAULT CHARSET=utf8 COMMENT='5.6' ;

ALTER TABLE `my_db_name`.`_my_table_name_new` ADD COLUMN approve_text TEXT AFTER reject_text ;

CREATE DEFINER=`migrator`@`10.81.0.0/255.255.0.0` TRIGGER `pt_osc_my_db_name_my_table_name_del` AFTER DELETE ON `my_db_name`.`my_table_name` FOR EACH ROW DELETE IGNORE FROM `my_db_name`.`_my_table_name_new` WHERE `my_db_name`.`_my_table_name_new`.`my_table_name_id` <=> OLD.`my_table_name_id` ;

CREATE DEFINER=`migrator`@`10.81.0.0/255.255.0.0` TRIGGER `pt_osc_my_db_name_my_table_name_upd` AFTER UPDATE ON `my_db_name`.`my_table_name` FOR EACH ROW BEGIN DELETE IGNORE FROM `my_db_name`.`_my_table_name_new` WHERE !(OLD.`my_table_name_id` <=> NEW.`my_table_name_id`) AND `my_db_name`.`_my_table_name_new`.`my_table_name_id` <=> OLD.`my_table_name_id`;REPLACE INTO `my_db_name`.`_my_table_name_new` (`my_table_name_id`, `tour_id`, `status`, `fields`, `comment`, `reject_reasons`, `reject_text`, `creation_timestamp`, `requester_user_type`, `update_timestamp`, `update_user_type`, `update_user_id`) VALUES (NEW.`my_table_name_id`, NEW.`tour_id`, NEW.`status`, NEW.`fields`, NEW.`comment`, NEW.`reject_reasons`, NEW.`reject_text`, NEW.`creation_timestamp`, NEW.`requester_user_type`, NEW.`update_timestamp`, NEW.`update_user_type`, NEW.`update_user_id`);END

CREATE DEFINER=`migrator`@`10.81.0.0/255.255.0.0` TRIGGER `pt_osc_my_db_name_my_table_name_ins` AFTER INSERT ON `my_db_name`.`my_table_name` FOR EACH ROW REPLACE INTO `my_db_name`.`_my_table_name_new` (`my_table_name_id`, `tour_id`, `status`, `fields`, `comment`, `reject_reasons`, `reject_text`, `creation_timestamp`, `requester_user_type`, `update_timestamp`, `update_user_type`, `update_user_id`) VALUES (NEW.`my_table_name_id`, NEW.`tour_id`, NEW.`status`, NEW.`fields`, NEW.`comment`, NEW.`reject_reasons`, NEW.`reject_text`, NEW.`creation_timestamp`, NEW.`requester_user_type`, NEW.`update_timestamp`, NEW.`update_user_type`, NEW.`update_user_id`)

ANALYZE TABLE `my_db_name`.`_my_table_name_new` /* pt-online-schema-change */

RENAME TABLE `my_db_name`.`my_table_name` TO `my_db_name`.`_my_table_name_old`, `my_db_name`.`_my_table_name_new` TO `my_db_name`.`my_table_name`


DROP TRIGGER IF EXISTS `my_db_name`.`pt_osc_my_db_name_my_table_name_del`

DROP TRIGGER IF EXISTS `my_db_name`.`pt_osc_my_db_name_my_table_name_upd`

DROP TRIGGER IF EXISTS `my_db_name`.`pt_osc_my_db_name_my_table_name_ins`