add foreign keys part 9

refs CNVS-6202

Change-Id: Ie2c879c356fd9181bb5a40b3f976b1aec73edba0
Reviewed-on: https://gerrit.instructure.com/24639
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:
Cody Cutrer 2013-09-24 09:25:49 -06:00
parent 2c8fb04e0a
commit 2d94a43357
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
class AddForeignKeys9 < ActiveRecord::Migration
tag :postdeploy
disable_ddl_transaction!
def self.up
add_foreign_key_if_not_exists :discussion_entry_participants, :users, delay_validation: true
add_foreign_key_if_not_exists :discussion_topic_participants, :users, delay_validation: true
add_foreign_key_if_not_exists :discussion_topics, :users, column: :editor_id, delay_validation: true
add_foreign_key_if_not_exists :discussion_topics, :users, delay_validation: true
add_foreign_key_if_not_exists :enrollments, :users, column: :associated_user_id, delay_validation: true
add_foreign_key_if_not_exists :enrollments, :users, delay_validation: true
add_foreign_key_if_not_exists :external_feed_entries, :users, delay_validation: true
add_foreign_key_if_not_exists :external_feeds, :users, delay_validation: true
add_foreign_key_if_not_exists :grading_standards, :users, delay_validation: true
add_foreign_key_if_not_exists :group_memberships, :users, delay_validation: true
end
def self.down
remove_foreign_key_if_exists :discussion_entry_participants, :users
remove_foreign_key_if_exists :discussion_topic_participants, :users
remove_foreign_key_if_exists :discussion_topics, column: :editor_id
remove_foreign_key_if_exists :discussion_topics, :users
remove_foreign_key_if_exists :enrollments, column: :associated_user_id
remove_foreign_key_if_exists :enrollments, :users
remove_foreign_key_if_exists :external_feed_entries, :users
remove_foreign_key_if_exists :external_feeds, :users
remove_foreign_key_if_exists :grading_standards, :users
remove_foreign_key_if_exists :group_memberships, :users
end
end