canvas-lms/db/migrate
Jon Jensen 0b1655e76d conversation messages for submission comments, fixes #5443
this commit makes submission first-class citizens in conversations. this
means that when submission comments are added/deleted, or assignments are
unmuted, conversations and messages will be updated accordingly

the main impacts in the ui are:

1. submissions can be deleted from conversations. if a new comment is
   added, they will reappear
2. submissions factor into the message total for the conversation. each
   submission counts as a single message, even if there are multiple
   comments
3. submission messages affect unread-ness, and are reflected in the
   timestamp and text in the conversation preview

test plan:

1. confirm submissions appear in the appropriate conversations, i.e.
   * submissions with no comments should not appear in any conversations
   * submissions where there are comments but not by instructors:
     * should appear in each instructor's private conversation with the
       submitter
     * should not appear in the submitter's private conversations with
       anyone
   * submissions where there are comments by instructors:
     * should appear in each commenting instructor's private conversation
       with the submitter
     * should appear in submitter's private conversations with each
       commenting instructor
   adding or removing submission comments should update private
   conversations accordingly (e.g. when one teacher comments on a
   submission, it should be removed from the other teachers' private
   conversations with the submitter).
2. for each scenario above where the submission comments are added and
   appear in conversations, ensure that the submission as a whole behaves
   like a single conversation message, i.e.
   * the unread conversations count is incremented and the private
     conversation is marked as unread (if it didn't exist or was already
     read)
   * the latest submission comment and timestamp should be reflected in
     the conversation pane on the left side
   * you can delete the submission from the conversation. if new comments
     are posted on the submission, the submission should reappear in the
     conversation (provided it still matches the criteria in 1.). note
     that submission can not be forwarded to other conversations.
3. submissions should differ from traditional conversation messages in
   that:
   * they should not trigger conversation notifications
   * they should not create/bump conversation stream items. if a
     conversation has non-submission messages, the submission and its
     comments should appear in the stream item, but they should not
     cause it to jump to the top

migration:

existing submissions/comments will be migrated in, but not necessarily
through a traditional rails migration. to bring in those messages, run
the following from the rails console:

 Submission.find_each{ |s| s.create_or_update_conversations!(:migrate) }

Change-Id: I06dcb8728402a6c4c613d445b80432a1f2973b73
Reviewed-on: https://gerrit.instructure.com/8086
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-20 15:56:32 -07:00
..
20101210192618_init_canvas_db.rb Merge branch 'master' into dev/postgres 2011-03-22 16:23:04 -06:00
20101216224513_create_delayed_jobs.rb Initial commit. 2011-01-31 18:57:29 -07:00
20110102070652_add_extra_time_to_quiz_submissions.rb quiz moderation 2011-02-11 22:08:42 -07:00
20110118001335_add_ip_filter_to_quizzes.rb ip filtering for quizzes 2011-02-11 22:16:47 -07:00
20110203205300_add_attachment_to_content_migration.rb allow migrations to work across job servers 2011-02-07 15:07:49 -07:00
20110208031356_add_delayed_jobs_tag.rb update delayed_jobs and list most popular job types in UI 2011-02-08 14:12:52 -07:00
20110214180525_create_account_notifications.rb account-level notifications 2011-02-16 21:34:05 -07:00
20110217231741_add_podcast_options_to_discussion_topics.rb topic podcasts 2011-03-28 14:32:16 -06:00
20110220031603_add_require_initial_post_to_discussion_topics.rb option to require initial post before seeing replies 2011-03-29 22:56:45 -06:00
20110223175857_add_restriction_options_to_courses_and_sections.rb enforce term/course/section start and end dates 2011-03-01 13:47:12 -07:00
20110302054028_change_fudge_points_to_float.rb fix typo in migration script 2011-03-23 18:02:23 -06:00
20110303133300_add_cross_listing_info.rb adding account field to course section model 2011-03-08 15:14:49 -07:00
20110307163027_add_ungraded_count_to_assignments.rb assignments.needs_grading_count counter to speed things up, closes #3945 2011-03-23 10:36:15 -06:00
20110308223938_create_context_external_tools.rb basic lti support 2011-03-23 16:58:11 -06:00
20110311052615_add_associated_asset_to_learning_outcome_results.rb align question banks to outcomes 2011-03-25 15:39:56 -06:00
20110315144328_change_context_message_viewed_user_ids_size.rb make viewed_user_ids on context_messages bigger 2011-03-15 08:56:38 -06:00
20110321151227_add_stream_item_instances_index.rb add stream_item_instances index to optimize deletes 2011-03-21 09:54:25 -06:00
20110321204131_add_created_at_to_page_views_index.rb add created_at to the page_views index on account_id 2011-03-22 08:12:11 -06:00
20110321234519_ungraded_count_triggers.rb assignments.needs_grading_count counter to speed things up, closes #3945 2011-03-23 10:36:15 -06:00
20110322164900_add_quiz_require_lockdown_browser.rb add infrastructure for supporting lockdown browser plugins, refs #3129 2011-03-22 14:51:01 -06:00
20110325162810_ungraded_count_triggers2.rb hairtrigger bump, new migration. fixes postgres trigger bug 2011-03-25 12:10:36 -06:00
20110325200936_add_position_to_communication_channel_indexes.rb add position to the communication_channel indexes 2011-03-25 16:16:46 -06:00
20110329223720_string_columns_to_text.rb change some columns from string -> text, refs #4136 2011-03-30 09:19:13 -06:00
20110330192602_postgres_compat_fixes.rb properly support attachments > 2GB, another string -> text fix 2011-03-30 14:22:15 -06:00
20110330204732_add_old_media_id_to_media_comments.rb migration process for moving to new kaltura instance 2011-04-13 22:50:30 -06:00
20110331145021_allow_long_certificate_fingerprint.rb allow arbitrarily long certificate fingerprint 2011-03-31 08:57:54 -06:00
20110401163322_varchars_to_text.rb string validations/fixes, closes #4154. wiki fixes, closes #3973, #4168 2011-04-05 11:22:50 -06:00
20110401214033_add_content_export.rb added ui for course exports 2011-04-15 10:27:14 -06:00
20110405210006_web_conference_settings.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110409232339_add_workflow_state_to_grading_standards.rb grading standards improvements 2011-05-21 19:20:34 -06:00
20110411214502_add_migration_ids_for_cc_importing.rb start canvas cartridge importing 2011-04-18 08:09:16 -06:00
20110412154600_add_grade_publishing_status_to_enrollments.rb sis grade publishing backend 2011-04-27 16:23:00 -06:00
20110414160750_add_media_comment_to_context_message.rb ui and db migration to add voice comment to contextmessage 2011-04-15 14:01:17 -06:00
20110415103900_add_last_course_to_course_section.rb xlist sis importing tests with fixes 2011-04-15 15:36:18 -06:00
20110416052050_add_quiz_require_lockdown_browser_for_results.rb adding ldb requirement for viewing quiz results 2011-04-20 10:11:21 -06:00
20110420162000_rename_last_course_to_nonxlist_course_in_course_section.rb renaming last_course to nonxlist_course and changing crosslisting semantics 2011-04-21 15:43:39 -06:00
20110426161613_add_delayed_jobs_max_attempts.rb add support for per-job max attempts, refs #4311 2011-04-26 10:38:38 -06:00
20110503231936_expand_content_migration_migration_settings.rb increase limit of content_migrations.migration_settings to 500kb 2011-05-04 08:27:11 -06:00
20110505055435_add_disabled_to_plugin_settings.rb better support for disabling plugins 2011-05-14 23:52:04 -06:00
20110505141533_add_thumbnail_uuid.rb thumbnail support when using local storage, closes #4500 2011-05-06 08:11:18 -06:00
20110510155237_add_error_reports_data_hash.rb create error report locally on javascript errors, refs #4487 2011-05-11 08:47:49 -06:00
20110510171100_add_sis_communication_channel_to_pseudonyms.rb update existing sis communication channel instead of creating new ones. fixes #4538 2011-05-11 10:34:08 -06:00
20110510180611_add_error_report_category.rb generate an error report for all errors, not just some of them 2011-05-11 10:36:56 -06:00
20110511194408_add_stream_item_instance_hidden.rb hiding stream items on the dashboard, closes #4387 2011-05-17 07:57:01 -06:00
20110513162300_add_template_course_id_to_courses.rb keep crosslisted course data up-to-date via sis imports for original course 2011-05-31 13:03:05 -06:00
20110516222325_create_delayed_jobs_test_story.rb add strand support to delayed jobs, refs #4226, closes #4415 2011-05-19 10:51:01 -06:00
20110516225834_add_delayed_jobs_strand.rb add strand support to delayed jobs, refs #4226, closes #4415 2011-05-19 10:51:01 -06:00
20110516233821_conversations.rb models and controllers for new messaging, refs #3977 2011-05-19 16:21:32 -06:00
20110520164623_add_sis_batch_batch_mode.rb support batch mode for sis imports, refs #4397 2011-05-23 09:52:56 -06:00
20110522035309_create_access_tokens.rb oauth 2 requests via access tokens 2011-06-02 09:15:11 -06:00
20110525175614_add_parameters_to_account_reports.rb allow reports to have parameters. refs #4315 2011-05-25 19:39:12 -06:00
20110526154853_remove_quiz_data_ids.rb remove question id from data on clone, fixes #4684 2011-05-26 16:14:01 -06:00
20110527155754_create_trigger_submissions_insert.rb explicitly version submissions refs #4189 2011-05-31 11:14:45 -06:00
20110531144916_cleanup_delayed_jobs_indexes.rb optimize delayed jobs table indexes, closes #4736 2011-06-01 10:32:57 -06:00
20110601222447_conversation_tweaks.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110602202130_add_group_root_account.rb add root_account relation to groups, refs #4247 2011-06-03 10:45:34 -06:00
20110602202133_add_group_sis_columns.rb add groups/group_memberships to sis csv import, closes #4247 2011-06-03 15:17:08 -06:00
20110606160200_refactor_abstract_courses.rb refactor abstract courses stage 2 2011-06-27 11:01:06 -06:00
20110609212540_message_attachments_and_media_objects.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110610163600_add_sticky_xlisting.rb make non-sis crosslisting sticky 2011-06-16 08:42:46 -06:00
20110610213249_optimize_delayed_jobs.rb optimize delayed jobs failed jobs, strands, and held jobs, refs #4792 2011-06-13 12:49:46 -06:00
20110617200149_convert_storage_quotas_to_bytes.rb finish conversion of storage_quota to bytes from MB 2011-07-19 09:28:59 -06:00
20110706183249_drop_old_stream_item_indexes.rb remove a now-unused stream_item_instances index, closes #4586 2011-07-06 12:56:34 -06:00
20110708151915_add_real_user_id_to_page_views.rb record real_user in page_view fixes #5013 2011-07-08 11:54:48 -06:00
20110708231141_locale_prefs.rb locale detection and selection, refs #4994 2011-07-20 09:24:55 -06:00
20110720185610_create_alerts.rb alerts, closes #4317 2011-08-24 10:19:44 -06:00
20110801034931_message_counts.rb integrated new messaging design, added forward functionality 2011-08-10 16:24:16 -06:00
20110801080015_message_forwards.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110803192001_unread_counts.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110804195852_label_conversations.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110805003024_add_developer_key_redirect_uri.rb oauth2 web app flow, refs #5029 2011-08-23 17:27:47 -06:00
20110809193507_fix_duplicate_discussions.rb migration to repair duplicate discussions 2011-09-06 15:05:15 -06:00
20110809221718_add_settings_to_courses.rb add setting for hiding total in grade summary 2011-08-11 16:43:56 -06:00
20110810194057_conversations_has_attachments_not_null.rb attachments and media comments for new conversations 2011-08-17 17:00:36 -06:00
20110816152405_new_inbox_media_comments.rb add columns for media comments so the user can be the context 2011-08-16 21:14:08 -06:00
20110816203511_message_migration.rb typo fix 2011-08-17 14:27:42 -06:00
20110817173455_submission_has_admin_comment.rb submissions.has_admin_comment 2011-08-17 17:58:12 -06:00
20110817193126_increase_folder_name_size.rb allow folder paths to be longer than 255 characters 2011-08-18 08:59:59 -06:00
20110817210423_create_triggers_submission_comments_insert_and_submission_comments_delete.rb submissions.has_admin_comment 2011-08-17 17:58:12 -06:00
20110819205044_context_to_conversation_notification_preferences.rb fix notification pref migration 2011-08-20 07:54:51 -06:00
20110820021607_add_external_tool_flags.rb basic lti navigation links 2011-11-04 17:07:17 -06:00
20110822151806_remove_inactive_enrollment_state.rb workflow_state is a string, not a symbol 2011-08-23 13:07:36 -06:00
20110824191941_conversation_message_context.rb fix wrong hostname in message emails 2011-08-24 15:30:37 -06:00
20110825131747_add_useful_indexes.rb add a few useful indexes 2011-08-25 13:58:01 -06:00
20110825214829_question_data_length.rb bump question_data size, limit possible combinations. fixes #4953 2011-08-29 13:37:09 -06:00
20110826153155_add_grading_standards_version.rb support fractional values in grading schemes, closes #5397 2011-08-29 12:04:28 -06:00
20110830152834_conversations_count_fix.rb fix conversation count bug, closes #5428 2011-08-30 11:27:54 -06:00
20110830154202_add_replacement_course_id_to_courses.rb re-do reset course refs #4583 2011-08-30 11:40:40 -06:00
20110830213208_clear_sis_whitespace.rb clear whitespace on sis csv imports 2011-08-31 18:26:42 -06:00
20110831210257_add_delayed_jobs_next_in_strand.rb eliminate next-job strand subquery, closes #5485 2011-09-02 15:16:23 -06:00
20110901153920_drop_mailboxes.rb drop mailboxes table 2011-09-06 09:20:46 -06:00
20110901202140_drop_context_code_from_role_override.rb drop role_overrides.context_code 2011-09-13 10:16:23 -06:00
20110902032958_drop_moved_in_account_structure.rb remove dead columns and indexes 2011-09-06 09:20:58 -06:00
20110902033742_drop_type_from_users.rb remove never-used column and index 2011-09-14 09:15:11 -06:00
20110906215826_add_parameters_to_course_imports.rb run course copy asynchronously in a job; fixes #5422 2011-09-08 08:23:47 -06:00
20110908150019_turnitin_settings.rb assignment-level turnitin settings, closes #4938 2011-09-27 16:02:01 -06:00
20110913171819_remove_section_and_hidden_tabs_from_courses.rb remove unused columns from courses 2011-09-13 12:53:03 -06:00
20110914215543_add_muted_to_assignments.rb add "mute" function to assignments. fixes #5101 2011-09-30 17:28:25 -06:00
20110920163900_generic_sis_stickiness_refactor_columns.rb inverted logic fix for stickiness migration 2011-10-11 14:00:33 -06:00
20110920163901_generic_sis_stickiness_refactor_data.rb inverted logic fix for stickiness migration 2011-10-11 14:00:33 -06:00
20110920165939_add_hidden_to_submission_comments.rb add "mute" function to assignments. fixes #5101 2011-09-30 17:28:25 -06:00
20110925050308_remove_unused_sis_data_fields.rb remove unused sis_data columns 2011-09-26 13:44:05 -06:00
20110927163700_add_enrollment_sis_stickiness.rb adding start and end date stickiness 2011-09-30 11:00:09 -06:00
20110928191843_add_index_discussion_topics_assignment_id.rb add index to discussion_topics.assignment_id 2011-09-28 14:54:02 -06:00
20110930041946_add_new_tab_to_content_tags.rb option to open BLTI links in a new tab 2011-10-07 13:44:52 -06:00
20110930122100_add_enrollment_grade_publishing_message.rb store grade publishing messages 2011-09-30 13:46:59 -06:00
20110930235857_unscribd_text_html_attachments.rb don't try and scribd html 2011-10-06 16:15:51 -06:00
20111005201509_create_favorites.rb added favorite courses option to main menu 2011-10-24 15:50:34 -06:00
20111006220252_update_account_associations_for_users_with_duplicates.rb add a migration to update account associations for users with duplicates; refs #4565 2011-10-06 16:25:28 -06:00
20111007115900_group_categories_migration.rb GroupCategory model 2011-10-10 09:36:06 -06:00
20111007115901_group_categories_data_migration.rb fix group_category migration 2011-10-17 12:42:47 -06:00
20111007143900_add_group_categories_self_signup_migration.rb self signup group categories 2011-10-11 17:22:46 -06:00
20111007172800_add_sis_options.rb allow sis imports to make things sticky or clear stickiness altogether 2011-10-13 10:54:58 -06:00
20111010173231_update_twitter_urls_for_https.rb update avatar urls for twitter to https in migration 2011-10-10 13:01:18 -06:00
20111010205553_drop_deleted_unique_id_from_pseudonyms.rb drop Pseudonym#deleted_unique_id closes #5896 2011-10-11 14:10:54 -06:00
20111010214049_add_pseudonym_sis_stickiness.rb make Pseudonym#unique_id sis sticky refs #5897 2011-10-11 10:16:06 -06:00
20111010223224_drop_sis_source_id_from_pseudonyms.rb drop Pseudonym#sis_source_id closes #5897 2011-10-12 12:18:37 -06:00
20111017124400_group_categories_cleanup_migration.rb cleanup migration to go with 70c18ac 2011-10-17 16:01:55 -06:00
20111017165221_turnitin_fix.rb fix for existing turnitin assignments, closes #5977 2011-10-17 12:35:17 -06:00
20111018221343_drop_invitation_email_from_enrollments.rb drop unused Enrollments#invitation_email 2011-10-21 10:41:22 -06:00
20111019152833_update_submitted_at_for_discussion_topics.rb use first discussion topic post for late deadline. fixes #5828. 2011-10-20 09:23:41 -06:00
20111020191436_translate_links_on_assessment_questions.rb make sure links in assessment questions are correctly translated, fixes #6012 2011-10-21 08:36:34 -06:00
20111021161157_drop_enrollment_id_from_attachments.rb drop completely unused attachments.enrollment_id 2011-10-21 10:41:34 -06:00
20111026055002_delete_sub_entries_of_deleted_discussion_entries.rb make sure discussion subentry is deleted with parent 2011-10-28 12:42:32 -06:00
20111026193530_drop_name_details_from_users.rb expose sortable name to user, fixes #5317 2011-10-31 12:22:08 -06:00
20111026193841_index_user_sortable_name_case_insensitively.rb expose sortable name to user, fixes #5317 2011-10-31 12:22:08 -06:00
20111026201231_restore_users_sortable_name.rb expose sortable name to user, fixes #5317 2011-10-31 12:22:08 -06:00
20111031145929_grandfather_open_registration.rb grandfather in accounts with old not-secure-by-default settings 2011-10-31 10:53:06 -06:00
20111108150000_ensure_submissions_for_discussions.rb update submissions with null submission type 2011-11-14 15:50:31 -07:00
20111109005013_fix_ungraded_counts.rb fix performance and correctness of triggers, closes #4471, #5168 2011-11-21 09:06:43 -07:00
20111111165300_cleanup_quiz_question_links.rb cleanup links in quiz questions; fixes #6212 2011-11-22 16:23:44 -07:00
20111111225824_add_external_tool_clone_id.rb remove_column, not drop_column 2011-11-18 13:38:02 -07:00
20111114164345_favorites_user_index.rb add index on favorites.user_id 2011-11-14 10:11:29 -07:00
20111117202549_create_triggers_enrollments_insert_and_enrollments_update.rb fix performance and correctness of triggers, closes #4471, #5168 2011-11-21 09:06:43 -07:00
20111118221746_add_persistence_token_table.rb make "stay logged in" use a one-time token 2011-11-22 10:15:13 -07:00
20111121175219_disable_open_registration_for_delegated_auth.rb disable open registration for accounts with delegated authentication 2011-11-28 15:52:50 -07:00
20111122162413_submission_points_possible_fix_column.rb fix quiz_submission.quiz_points_possible 2011-12-06 09:07:06 -07:00
20111122162607_submission_points_possible_fix_data.rb stricter checks to avoid casting error 2011-12-14 09:11:29 -07:00
20111122172335_create_trigger_quiz_submissions_update.rb correctly update quiz status re: essay questions. fixes #5436 2011-11-29 10:18:25 -07:00
20111123022449_fix_enrollment_root_account_id.rb keep root_account_id in sync between course/enrollments 2011-11-28 14:29:58 -07:00
20111128205419_drop_sis_cross_listed_section.rb drop SisCrossListedSection 2011-11-28 14:27:10 -07:00
20111128212056_drop_sticky_xlist_from_course_sections.rb drop sticky_xlists from course_sections 2011-11-28 14:58:08 -07:00
20111209000047_fix_spelling_of_privileges_column_on_enrollments.rb fix spelling of "privileges" in enrollments. 2011-12-19 16:48:42 -07:00
20111212152629_appointment_groups.rb calendar and scheduler apis; refs #3395 2012-01-06 12:35:27 -07:00
20111221230443_appointment_participant_visibility.rb calendar and scheduler apis; refs #3395 2012-01-06 12:35:27 -07:00
20111223215543_index_calendar_events_effective_context_code.rb calendar and scheduler apis; refs #3395 2012-01-06 12:35:27 -07:00
20111228210808_add_indexes_to_pseudonyms.rb better indexes for pseudonyms closes #6193 2011-12-30 10:07:30 -07:00
20111230165936_add_communication_channels_index.rb search for communication channels case insensitively fixes #6750 2011-12-30 19:36:29 -07:00
20111230172131_fix_assessment_questions_missing_data.rb make the migration only send later if production 2012-01-06 15:22:00 -07:00
20120103235126_change_rubric_points_possible_to_float.rb handle decimal points in rubrics correctly 2012-01-06 16:34:48 -07:00
20120104170646_remove_attachments_with_no_scope_from_list.rb don't add items to list if their scope is nil 2012-01-04 11:16:50 -07:00
20120104183918_fix_sis_communication_channels.rb fix existing bad data from the sis_cc bug refs #6707 2012-01-05 09:05:37 -07:00
20120105201643_drop_user_creation_columns.rb drop unused user.creation_* columns 2012-01-10 10:49:49 -07:00
20120105205517_drop_account_type.rb drop unused column accounts.type 2012-01-06 15:56:23 -07:00
20120105210857_drop_old_sis_sticky_columns.rb drop unused sis sticky columns 2012-01-10 10:49:55 -07:00
20120105221640_change_sis_batch_id_to_integer.rb store sis_batch_id as an integer, not a string 2012-01-11 09:14:36 -07:00
20120106220543_set_saml_entity_id.rb make saml entity use the account's domain 2012-01-10 12:45:08 -07:00
20120111202225_submission_comments_in_conversations.rb conversation messages for submission comments, fixes #5443 2012-01-20 15:56:32 -07:00
20120115222635_destroy_existing_anonymous_folder_downloads.rb don't send files to users in public courses we shouldn't; fixes #6868 2012-01-16 10:50:47 -07:00
20120116151831_drop_triggers_submission_comments_and_submission_comments.rb conversation messages for submission comments, fixes #5443 2012-01-20 15:56:32 -07:00
20120120161346_index_cleanup_pt1.rb clean up some unused and inefficient indexes 2012-01-20 13:53:50 -07:00
20120120190358_drop_stream_items_user_id.rb clean up some unused and inefficient indexes 2012-01-20 13:53:50 -07:00