P
paul.m.henderson
Hi,
I've got a database that I'm in the middle of redesigning and came
across an interesting situation. The basic purpose of the database is
to catalog objects within a room (think facilities management). A
major requirement is that each object must have multiple photographs.
Now, the photographs will not be stored in the database, but rather
only the file path. However, the problem is that there are multiple
items that can have photographs. These items range from objects in a
room, to employees, to the room itself to the structure housing the
room. So, what I've got is one photographs table with an object type
field which is used to distinguish what the photograph is of, and a
foreign key. I've included some sample records below:
photographId | photographType | foreignKeyId
1 | structure | 1
2 | room | 1
3 | object | 1
I know that proper database design would have a separate table for each
type of photograph, however, that seems redundant as each table would
have the same fields and hold basically the same types of information.
Is there a better way to design for this situation? Thanks!
I've got a database that I'm in the middle of redesigning and came
across an interesting situation. The basic purpose of the database is
to catalog objects within a room (think facilities management). A
major requirement is that each object must have multiple photographs.
Now, the photographs will not be stored in the database, but rather
only the file path. However, the problem is that there are multiple
items that can have photographs. These items range from objects in a
room, to employees, to the room itself to the structure housing the
room. So, what I've got is one photographs table with an object type
field which is used to distinguish what the photograph is of, and a
foreign key. I've included some sample records below:
photographId | photographType | foreignKeyId
1 | structure | 1
2 | room | 1
3 | object | 1
I know that proper database design would have a separate table for each
type of photograph, however, that seems redundant as each table would
have the same fields and hold basically the same types of information.
Is there a better way to design for this situation? Thanks!