I'm creating an attachments logic in my system, but I don't know what solution would be a better practice

I made some diagrams:

Multiple table with same fields: enter image description here

Only one table, but it references to all the others: enter image description here

  • The first image looks like an m:n relationship, while in the second one it looks more like 1:n. Also, you cannot have a foreign key constraint in your second image. Sep 19, 2023 at 19:07
  • Is AttachmentType an attribute of the attachment, or can it be different each instance it is attached to something? Can it be attached multiple times? (Either way, the 2nd model seems broken.) Sep 20, 2023 at 0:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.