SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='TRADITIONAL,ALLOW_INVALID_DATES';

ALTER TABLE `sog`.`glam_transaction` ADD COLUMN `last_changed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP  AFTER `transaction_type` ;

ALTER TABLE `sog`.`glam_transaction_schedule` ADD COLUMN `last_changed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP  AFTER `sched_job_card` ;

ALTER TABLE `sog`.`glam_his_access_point` 
ADD INDEX `idx_lock_rf` (`access_point_rf_id` ASC) 
, ADD INDEX `idx_his_type_lock` (`his_action` ASC) ;

ALTER TABLE `sog`.`glam_his_access_object_key` 
ADD INDEX `idx_key_serial` (`access_obj_serial_no` ASC) 
, ADD INDEX `idx_his_type_key` (`his_action` ASC) ;

ALTER TABLE `sog`.`glam_his_transaction` 
ADD INDEX `idx_his_type_trans` (`his_action` ASC) ;

ALTER TABLE `sog`.`glam_his_transaction_schedule` 
ADD INDEX `idx_his_type_schedule` (`his_action` ASC) ;

ALTER TABLE `sog`.`glam_supervisor_schedule` CHANGE COLUMN `transaction_location` `transaction_location` POINT NULL  ;

ALTER TABLE `sog`.`glam_his_objholder` 
ADD INDEX `idx_his_type_objholder` (`his_action` ASC) ;

ALTER TABLE `sog`.`glam_his_systemuser` 
ADD INDEX `idx_his_type_systemuser` (`his_action` ASC) ;


SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
