Mysql – Referential Integrity in schema, cascading the renaming

MySQLschema

In phpMyAdmin, while renaming a column/table which is referenced by some foreign key, I get an error. I can not rename a column until I remove all its relations.

There should be facilitated integrity of schema, just like referential integrity i.e. cascading on delete and update column/table name.

User should be allowed to rename a column/table only if user has also permissions to the related tables/columns. Then, cascade this change throughout schema i.e. (foreign keys,triggers etc.)

I have tried to post above request on mysql here Link but get error This form is invalid or has expired, please try again shortly

Please guide me Is this a good request . No? then why? Yes? then where should I and how can i submit it?

Best Answer

Referential integrity is one, and is an attribute of the table data, but it is not an attribute of the table's schema. A table's schema shouldn't be changed in a cascading style, because it can break existing working code. A table's column is not used only in foreign keys, triggers, etc. It's used in scripts, maintenance plans, jobs, applications, dlls, even web pages etc. If you change an object's name you can create a mess, that's why it shouldn't be done automatically. This is something you want to control.

This is where refactoring tools can enter the scene. Eg for MS SQL Server there's Visual Studio db projects that can help here, but not by much. There may be tools that aid in refactoring the db objects and fix anything automatically, but they are not part of any standard db package.