add foreign keys part 14
refs CNVS-6202 Change-Id: I4a86dff6cba47e33ac5aeef789bc0fe0db69dde4 Reviewed-on: https://gerrit.instructure.com/29494 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
17d84120f5
commit
74d508b1fb
|
@ -0,0 +1,30 @@
|
|||
class AddForeignKeys14 < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def self.up
|
||||
add_foreign_key_if_not_exists :assignment_override_students, :quizzes, delay_validation: true
|
||||
add_foreign_key_if_not_exists :assignment_overrides, :quizzes, delay_validation: true
|
||||
add_foreign_key_if_not_exists :collaborators, :groups, delay_validation: true
|
||||
add_foreign_key_if_not_exists :content_participations, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :content_tags, :learning_outcomes, delay_validation: true
|
||||
add_foreign_key_if_not_exists :context_module_progressions, :context_modules, delay_validation: true
|
||||
add_foreign_key_if_not_exists :course_sections, :courses, delay_validation: true
|
||||
add_foreign_key_if_not_exists :delayed_messages, :communication_channels, delay_validation: true
|
||||
add_foreign_key_if_not_exists :discussion_topic_materialized_views, :discussion_topics, delay_validation: true
|
||||
add_foreign_key_if_not_exists :migration_issues, :content_migrations, delay_validation: true
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_foreign_key_if_exists :assignment_override_students, :quizzes
|
||||
remove_foreign_key_if_exists :assignment_overrides, :quizzes
|
||||
remove_foreign_key_if_exists :collaborators, :groups
|
||||
remove_foreign_key_if_exists :content_participations, :users
|
||||
remove_foreign_key_if_exists :content_tags, :learning_outcomes
|
||||
remove_foreign_key_if_exists :context_module_progressions, :context_modules
|
||||
remove_foreign_key_if_exists :course_sections, :courses
|
||||
remove_foreign_key_if_exists :delayed_messages, :communication_channels
|
||||
remove_foreign_key_if_exists :discussion_topic_materialized_views, :discussion_topics
|
||||
remove_foreign_key_if_exists :migration_issues, :content_migrations
|
||||
end
|
||||
end
|
|
@ -670,6 +670,7 @@ describe CoursesController, type: :request do
|
|||
it "should deal gracefully with an invalid course id" do
|
||||
@course2.enrollments.scoped.delete_all
|
||||
@course2.course_account_associations.scoped.delete_all
|
||||
@course2.course_sections.scoped.delete_all
|
||||
@course2.destroy!
|
||||
json = api_call(:put, @path + "?event=offer&course_ids[]=#{@course1.id}&course_ids[]=#{@course2.id}",
|
||||
@params.merge(:event => 'offer', :course_ids => [@course1.id.to_s, @course2.id.to_s]))
|
||||
|
@ -728,6 +729,7 @@ describe CoursesController, type: :request do
|
|||
it "should report a failure if no updates succeeded" do
|
||||
@course2.enrollments.scoped.delete_all
|
||||
@course2.course_account_associations.scoped.delete_all
|
||||
@course2.course_sections.scoped.delete_all
|
||||
@course2.destroy!
|
||||
json = api_call(:put, @path + "?event=offer&course_ids[]=#{@course2.id}",
|
||||
@params.merge(:event => 'offer', :course_ids => [@course2.id.to_s]))
|
||||
|
|
|
@ -74,7 +74,8 @@ describe DataFixup::FixOutOfSyncOutcomeAlignments do
|
|||
|
||||
it "should delete alignments to assignments with rubrics without matching alignments" do
|
||||
align = @rubric_association_object.learning_outcome_alignments.first
|
||||
@rubric.learning_outcome_alignments.update_all(:learning_outcome_id => 0)
|
||||
lo = LearningOutcome.create!(short_description: 's')
|
||||
@rubric.learning_outcome_alignments.update_all(:learning_outcome_id => lo)
|
||||
|
||||
align.reload.should_not be_deleted
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
|
|
|
@ -133,7 +133,12 @@ describe "account" do
|
|||
end
|
||||
|
||||
it "should be able to create a new course when no other courses exist" do
|
||||
Account.default.courses.each { |c| c.enrollments.scoped.delete_all; c.course_account_associations.scoped.delete_all; c.destroy! }
|
||||
Account.default.courses.each do |c|
|
||||
c.course_account_associations.scoped.delete_all
|
||||
c.enrollments.scoped.delete_all
|
||||
c.course_sections.scoped.delete_all
|
||||
c.destroy!
|
||||
end
|
||||
|
||||
get "/accounts/#{Account.default.to_param}"
|
||||
f('.add_course_link').click
|
||||
|
|
Loading…
Reference in New Issue