Correct Title: pt-online-schema-change dropped the old and new table and I lost the data
Today I altered one of my tables (users) with pt-online-schema-change
One table(user_comments) of my database had a foreign key (refer) to users table.
I changed id column from int to bigint
But at the end when it wanted to rename new table to original table, this message was displayed:
Error updating foreign key constraints: 2017-06-14T10:17:41 DBD::mysql::db do failed: Error on rename of './myblog/_users_new' to './myblog/users' (errno: 150 "Foreign key constraint is incorrectly formed") [for Statement "RENAME TABLE `myblog`.`_users_new` TO `myblog`.`users`"] at /usr/bin/pt-online-schema-change line 10700.
I know what is this, and I know firstly I must alter user_comments table or remove Foreign key before alter users table, but I think pt-online-schema-change has bug because it should be kept up new table.
It was full command:
pt-online-schema-change -uxxxx -pxxxx --max-load "Threads_running=400" --set-vars=foreign_key_checks=0 --alter-foreign-keys-method=auto --no-check-alter --critical-load="Threads_running=200" --alter="CHANGE COLUMN id id BIGINT UNSIGNED NOT NULL FIRST" D=myblog,t=users --execute