Create new ExperimentSubject model with user_id, group_id, or project_id
Create a new ExperimentSubject model and the associated experiment_subjects table. Include all of the columns from the existing experiment_users table, including the user_id column, and also add group_id and project_id columns. Add a constraint which stipulates that at least one of user_id, group_id, or project_id must have a value.
In more detail:
- create a new
experiment_subjectstable, leave the existingexperiment_userstable as-is - give the new
experiment_subjectstable the same columns as the existingexperiment_userstable - give the new
experiment_subjectstable additional columns forgroup_idandproject_id - add a constraint to the new
experiment_subjectstable which stipulates that at least one ofuser_id,group_id, orproject_idmust have a value - create a new
ExperimentSubjectmodel - add an
Experiment#has_many :experiment_subjectsrelationship
Edited by Dallas Reedy