php - Assigned multiple users to a 'task' -
php - Assigned multiple users to a 'task' -
okay i'm creating task manager company. user can assign assign task multiple other users. i've though of 2 ways of implementing this.
this tasks table alternative 1 (at to the lowest degree columns of import in give-and-take ):
---------------------------------------------- | id | assigned_to | assigned_from | --------------------------------------------- | 1 | 1,3,6 | 4 | -------------------------------------------- | 2 | 1,4 | 2 | ---------------------------------------------
so here pretty much comma separate each user_id assigned particular task
option 2:
---------------------------------------------------------- | id | task_id | assigned_to | assigned_from | ------------------------------------------------------------ | 1 | 335901 | 1 | 4 | ----------------------------------------------------------- | 2 | 335901 | 3 | 4 | ----------------------------------------------------------- | 3 | 335901 | 6 | 4 | ----------------------------------------------------------- | 4 | 564520 | 1 | 2 | ----------------------------------------------------------- | 4 | 564520 | 4 | 2 | -----------------------------------------------------------
so can see here instead of putting assiged_to is's here create task id random number , can groupby 'task_id'. way have built reason feels might screw me on in future (not alternative 1 doesn't give me same feeling). question way guys recommend or there maybe different improve way doing this?
option 2 ist improve solution since can acutally work table. may e.g. create table tasks
with
task_id | task_name | budget | ...
or table user-ids assigned_to
, assigned_from
. these tables can joined if utilize 2nd option.
btw right normalization form
php mysql laravel database-schema
Comments
Post a Comment