Creating many-to-many relation on demand? Users can join projects.

Projects can have many tasks.

Each user completes the task at their own time, they can also have some other user specific settings on the task like the priority in their todo list and whether to hide it on completion or not.



The problem I'm facing is that some of these settings must have default values e.g. priority = 0, hideOnComplete = true. 

These must be available to the client for each project user at all times. How do I make that the TaskUser rows with the default values for the each user exist at all times?

Option A:


I create a TaskUser relation for every user in the project each time a new task is added to the project. 
I create a new TaskUser relation for each task in the project every time a new user joins the project.


I don't think this is the way to go since you have to be reacting to these events all the time and acting in response.

Option B:

Duplicate the default fields in the Task table. I include a priority and hideOnComplete field in the Task table. The client can then know what what to display on Task setting forms even if the TaskUser relation doesn't exist.

I no longer have to react to new users or tasks. A client can request the task object and populate the settings form with the default fields even when there is no TaskUser relation. Afterwards, when the users submits his own settings the client can look into the existing TaskUser relation for the correct values.

This seems to be a much better option to me. What do you think?
In your scenario, since (if I'm understanding correctly), every User will need to complete every Task in the Projects they belong to, there will need to be one UserTask per Task per User if you want to store things such as dateCompleted.

Because of this, Option A makes sense to me. You need to be "reacting to these events all the time and acting in response" anyway. One modification I would make though is that I would include a defaultHideOnComplete field in the User table. The TaskUser's hideOnComplete field would be initially set to the defaultHideOnComplete value for the User associated with it.

Option B doesn't make sense to me with what you're trying to accomplish, because it doesn't allow for every User to set their own hideOnComplete and priority values.

Let me know if I'm misunderstanding something : ]