I recently noticed that there are several bigint type fields in one of my databases that could be replaced with type “int”. The problem is that the database is already online and in use and also that there are foreign keys in action, so when I try changing the data type in the offline DB, mysql won’t let me and produces the error message: “#1025 – Error on rename of (…)”.
So how can I change these fields while keeping the foreign keys happy? (and not wiping out the existing DB!)
You can’t reduce the size of field when it holds data. You can only expand them.
What you can do is export all the data, disable the keys, empty the tables, change the field sizes & import the data again.