-- Session_ID, Plan_Game_ID  ==> ima_plan_session_game_status
CREATE TABLE IF NOT EXISTS `ima_connector_gamestatus` (
  `Id` bigint(20) NOT NULL AUTO_INCREMENT,
  `CB_Account_Id` bigint(20) NOT NULL COMMENT 'CB_Account table, field Id',
  `Session_ID` int(9) NOT NULL COMMENT 'pointer to table ima_plan_session_game_status',
  `Plan_Game_ID` int(9) NOT NULL COMMENT 'pointer to table ima_plan_session_game_status',
  `Game_End` timestamp NOT NULL DEFAULT current_timestamp(),
  `Last_Try` timestamp NULL DEFAULT NULL COMMENT 'timestamp of last upload try',
  `Attempts` int(9) DEFAULT 0 COMMENT 'attemps for uploads',
  `Uploaded` timestamp NULL DEFAULT NULL COMMENT 'timestamp of uploaded to external server',
  `Response_Status` int(11) DEFAULT NULL COMMENT 'response http status from remote server',
  `Response_Text` varchar(512) DEFAULT NULL COMMENT 'response text from remote server',
  `Disabled` TINYINT NOT NULL DEFAULT '0' COMMENT 'if disabled will not try anymore to upload',
  `Last_Edit` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
  PRIMARY KEY (`Id`),
  UNIQUE KEY `Session_ID` (`Session_ID`,`Plan_Game_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-- ALTER TABLE `ima_connector_gamestatus` ADD `Disabled` TINYINT NOT NULL DEFAULT '0' AFTER `Response_Text`;