KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Assume you want to build a database for some web application. This database already contains many tables and you might have to extend it in the future. Also, you want the end user to be able to comment any kind of object in the database. I would like to find a solution for this would be generic enough so that I don't have to extend it each time I add a new table in the database. I thought of the following: Table Name : comment columns : id : the id of a comment user_id : the id of the user making the comment object_table_name : the table where the commented object is object_id : the id of the commented object in the object_table_name table. text : the text date : the date This table sort of solve my problem, the only thing that troubles me is that the relational aspect of it is rather weak (I can't make object_id a foreign key for instance). Also if some day I need to rename a table I will have to change all the concerned entries in the comment table. What do you think of this solution ? Is there design pattern that would help me out ? Thanks.-
Tags (comma-separated)
Save Edits
Cancel