Extending table to add new columns failed

You either need to make the changes to core (via PR) or extend the core table(s) in your module. Extending a core table (e.g., adding start and stop date to a cohort member) would typically be done with something like:

create table expandedcohort_cohort_member
  (
    cohort_member_id int PRIMARY KEY,
    start_date datetime,
    stop_date datetime,
    FOREIGN KEY (cohort_member_id) REFERENCES cohort_member (cohort_member_id)
  )

Unfortunately, cohort_member in core was not designed to persist member entries, so does not have it’s own primary key (it only has cohort_id and patient_id). Since rows in cohort_member are purged as members are removed and there’s no cohort_member_id primary key, you can’t extend the core cohort members in your module as Darius suggested. :confounded:

This really needs to be done in core. The only way to add start & stop dates to cohort members via a module would be to alter the core table (adding a cohort_member_id primary key along with start & stop dates) as well as changing core’s behavior with cohort members (currently purging members that are removed). You’ll probably spend more time trying to do this in a module than you would making the changes to core.