I am unsure if my solution in creating this db schema is as best practice. This involves 2 tables.
The table structure below is what I have currently.
Table: tAttachmentType
Id | Name
1 | Report
2 | Screenshot
3 | Other
Table: tAttachments
Id | File | CreatedDate | AttachmentTypeId | DeletedDate | Active | DeletedBy | UploadedBy | EngagementId | IssueId
1 | asd323sdfwe | 01-01-2019 | 1 | NULL | 1 | NULL | 32 | 56 | NULL
2 | kut456fdghh | 01-01-2019 | 2 | NULL | 1 | NULL | 32 | NULL | 12345
3 | 345gvsdrfe4 | 01-01-2019 | 1 | NULL | 1 | NULL | 32 | 79 | NULL
4 | nmrwe432gfd | 01-01-2019 | 2 | NULL | 1 | NULL | 32 | NULL | 987645
Brief relationship in the tables. There can be multiple attachments for an issue OR an engagement. Every attachment must belong to one or the other. I am wondering about the EngagementId and the IssueId in the tAttachments table and whether that should be further normalized or is it okay to have null values like below.
If more info is needed, let me know.