do some minor datafixups before adding schema constraints

Change-Id: Ic4e887b46a8035daafb0bc0491ead1f0fc52557c
Reviewed-on: https://gerrit.instructure.com/29402
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2014-01-28 13:50:07 -07:00
parent e151b3c0a5
commit edafc091bd
2 changed files with 2 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class AddForeignKeys12 < ActiveRecord::Migration
add_foreign_key_if_not_exists :course_account_associations, :course_sections, delay_validation: true
add_foreign_key_if_not_exists :course_account_associations, :courses, delay_validation: true
add_foreign_key_if_not_exists :courses, :abstract_courses, delay_validation: true
DelayedMessage.where("NOT EXISTS (SELECT 1 FROM notification_policies WHERE notification_policy_id=notification_policies.id) AND notification_policy_id IS NOT NULL").delete_all
add_foreign_key_if_not_exists :delayed_messages, :notification_policies, delay_validation: true
add_foreign_key_if_not_exists :discussion_entries, :discussion_entries, column: :parent_id, delay_validation: true
add_foreign_key_if_not_exists :discussion_entries, :discussion_entries, column: :root_entry_id, delay_validation: true

View File

@ -2,6 +2,7 @@ class DisallowNullOnTeacherNotesColumn < ActiveRecord::Migration
tag :predeploy
def self.up
CustomGradebookColumn.where(teacher_notes: nil).update_all(teacher_notes: false)
change_column_null :custom_gradebook_columns, :teacher_notes, false
end