Database: what design to have a “document table” referencing others tables I have some tables which can have 0..* documents.

How can I design my data model to avoid having a specific document table for each of my tables? Feel free to suggest by editing the data model
Its pretty easy to do this but I wouldn't recommend it.  To implement a single "document" table for all possible documents and parents, you just abstract the id into a "parent_id" column, and add a "parent_table_name" column.

There are a lot of issues with this approach.  Some are:


Referential Integrity can no longer be enforced by the DBMS.
Query expression is now more complex.
Surrogate keys of a single numeric type are required for all the parents, even if that isn't the best choice for a given parent.
You cannot show the relationships visually on an ERD.  Instead, you now just have table boxes with no lines as there are no enforceable relationships.


The perceived simplicity of a single table with an abstract reference is seductive but ultimately proves to be the opposite of simple due to the above issues.  I think the appeal results from a misapplication of the principle of cohesion.  The cohesion here is really between the documents and the entity which they are about, not their structural similarity in that each table stores a "document."  Applying the principle of cohesion with respect to structure instead of functional meaning can get you into some other ill-advised practices such as OTLT and EAV.  

My recommendation is to stick with the design you already have.  It is correct and doesn't need "improved."