I literally had this idea 30 seconds ago - why not use the MySQL comments to store a serialized array that contains additional meta data for the column - at the very least the name of the table the column is a foreign key for, stuff like that.
Has this been done? What would be the ramifications, other than condensing where the meta information is stored. My own initial reaction to the idea is it's crazy - but maybe crazy enough to actually work.
[A little further research - there's a 60 character limit]
Any database has catalogs for this type of metadata.
I believe in MySQL information_schema covers that?
The information schema does cover that - and its where the comments are ultimately stored. But I have additional meta data in the system I'm building. One of the more critical pieces is the governing class for the table or field, which informs the primary model which class should be loaded to handle the table's data. Also, MySQL doesn't store relationships. It's possible to infer them through proper field naming, but they are explicitly named.
The convention I'm developing has the limitation that no field and no table can share a name arbitrarily. When the system encounters a field that has the same name as a table, it presumes the field is a foreign key for that table.
I suppose I should go back to having my own meta tables for this information.
what about the KEY_COLUMN_USAGE table?
This topic is now archived. It is frozen and cannot be changed in any way.