Create table:
CREATE TABLE `phppos_register_log` (
`register_log_id` int(10) NOT NULL AUTO_INCREMENT,
`employee_id` int(10) NOT NULL,
`shift_start` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`shift_end` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`open_amount` decimal(23,10) NOT NULL,
`close_amount` decimal(23,10) NOT NULL,
`cash_sales_amount` decimal(23,10) NOT NULL,
`deleted` int(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`register_log_id`),
KEY `phppos_register_log_ibfk_1` (`employee_id`),
CONSTRAINT `phppos_register_log_ibfk_1` FOREIGN KEY (`employee_id`) REFERENCES `phppos_employees` (`person_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
SQL CODE to rename column: (This works on mysql 5.5 and 5.6 but one user is reporting an issue. (Exact version number 5.5.40)
//this is where error is happening
ALTER TABLE phppos_register_log DROP FOREIGN KEY phppos_register_log_ibfk_1;
ALTER TABLE `phppos_register_log` CHANGE `employee_id` `employee_id_open` INT( 10 ) NOT NULL ;
ALTER TABLE `phppos_register_log`ADD CONSTRAINT `phppos_register_log_ibfk_1` FOREIGN KEY (`employee_id_open`) REFERENCES `phppos_employees` (`person_id`);
Is anything in mysql 5.5.40 that would cause this code to NOT work?
ERROR reported:
#1025 - Error on rename of './sole_phppos_144/phppos_register_log' to './sole_phppos_144/#sql2-6224-22975' (errno: 152)
NOTE: I am renaming column so I drop the constraint, rename column, then add the constraint back.