sql - Associate one column in table with two existing tables -
sql - Associate one column in table with two existing tables -
my db has next tables:
resource
: resources can uploaded on site groups
: groups on site users
: users on site (not part of grouping if like) now, when 1 uploads resource currently, ownership of resource given it's uploader
default. resource
table has column ownerid
foreign key association user
table.
but now, has changed such ownership of resource
given either user or entire group.
i'm trying decide migration scheme, move owner
beingness user entity either user
or group
. intuition when uploads material, can take owner user
or entire group
.
currently migration plans involves:
addownertype
(user, group, global) , userowner
, groupowner
within material
table (probably worse normalized table). ownertype
global
if owner --or-- group
if owner group
entity else user
. then when i'm querying resource
table, can check ownertype
condionally select owner either user
table or group
table. i not know if way. i'm using entity framework, , things started ugly user
, group
hardly have relationaship require me create generalized entity.
can expert guide me on this? considered migration plan in case? help or suggestions.
sql linq orm migration database-migration
Comments
Post a Comment