the main idea is that i can post an article , link or an attachment and i can receive comments on each of these types of posts (the structure of the comment is the same) , the problem here is that i can not create one comment table witch refers to a post id without knowing which type of post , i thought about three types of solutions in this case :
create link , article , attachment and link_Comment , article_Comment and article_Attachment tables so that every comment table is directly related to the type of post , however this type of solution will make my database very complex when working with more types of posts .
create link , article , attachment tables and create one comment table but with a column named type which can have only one of ('link','article','attachment') .
create link , article , attachment tables and create one comment table but with a column named type_id which is related to another table called IO_types that stores the different types (id,name) of posts so i can add whenever i want manually new types .
i want to know what are the best strategies when dealing with these types of problems and any hint will be appreciated !
thank you .
Aucun commentaire:
Enregistrer un commentaire