def migrate_cohort_settings(course):
 (cohort_settings, created) = CourseCohortsSettings.objects.get_or_create(course_id=course.id, defaults={'is_cohorted': course.is_cohorted, 'cohorted_discussions': list(course.cohorted_discussions), 'always_cohort_inline_discussions': course.always_cohort_inline_discussions})
 if created:
  manual_cohorts = CourseUserGroup.objects.filter(course_id=course.id, group_type=CourseUserGroup.COHORT).exclude(name__in=course.auto_cohort_groups)
  for cohort in manual_cohorts:
   CourseCohort.create(course_user_group=cohort)
  for group_name in course.auto_cohort_groups:
   CourseCohort.create(cohort_name=group_name, course_id=course.id, assignment_type=CourseCohort.RANDOM)
 return cohort_settings

def migrate_cohort_settings ( course ) : ( cohort_settings , created ) = CourseCohortsSettings . objects . get_or_create ( course_id = course . id , defaults = { 'is_cohorted' : course . is_cohorted , 'cohorted_discussions' : list ( course . cohorted_discussions ) , 'always_cohort_inline_discussions' : course . always_cohort_inline_discussions } ) if created : manual_cohorts = CourseUserGroup . objects . filter ( course_id = course . id , group_type = CourseUserGroup . COHORT ) . exclude ( name__in = course . auto_cohort_groups ) for cohort in manual_cohorts : CourseCohort . create ( course_user_group = cohort ) for group_name in course . auto_cohort_groups : CourseCohort . create ( cohort_name = group_name , course_id = course . id , assignment_type = CourseCohort . RANDOM ) return cohort_settings
migrate all the cohort settings associated with this course from modulestore to mysql .