MySQL – Alter table-change datatype of column with foreign key
Schema alteration is a big headache especially when it has already reached to production and things get worse when the relations are involved.Below is a short example for altering tables…
One response to “MySQL – Alter table-change datatype of column with foreign key”
Add this to get
foriegn keys relationships of a table with its childs with
SELECT `TABLE_SCHEMA`, `TABLE_NAME`, `COLUMN_NAME`, `REFERENCED_TABLE_SCHEMA`, `REFERENCED_TABLE_NAME`, `REFERENCED_COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = “my_schema” AND `REFERENCED_TABLE_NAME` = “my_parent_table”