add foreign keys part 15

refs CNVS-6202

Change-Id: I747f1891f6b24b5eb435f169279efae04a402e97
Reviewed-on: https://gerrit.instructure.com/29495
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-31 09:48:20 -07:00
parent c4ece90a90
commit cb46f2ecdd
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
class AddForeignKeys15 < ActiveRecord::Migration
tag :postdeploy
disable_ddl_transaction!
def self.up
add_foreign_key_if_not_exists :quiz_submissions, :quizzes, delay_validation: true
add_foreign_key_if_not_exists :quizzes, :assignments, delay_validation: true
add_foreign_key_if_not_exists :roles, :accounts, column: :root_account_id, delay_validation: true
add_foreign_key_if_not_exists :stream_item_instances, :users, delay_validation: true
add_foreign_key_if_not_exists :submission_comments, :submissions, delay_validation: true
add_foreign_key_if_not_exists :submissions, :assignments, delay_validation: true
add_foreign_key_if_not_exists :user_observers, :users, column: :observer_id, delay_validation: true
add_foreign_key_if_not_exists :user_observers, :users, delay_validation: true
add_foreign_key_if_not_exists :user_profile_links, :user_profiles, delay_validation: true
add_foreign_key_if_not_exists :user_profiles, :users, delay_validation: true
add_foreign_key_if_not_exists :web_conference_participants, :web_conferences, delay_validation: true
end
def self.down
remove_foreign_key_if_exists :quiz_submissions, :quizzes
remove_foreign_key_if_exists :quizzes, :assignments
remove_foreign_key_if_exists :roles, :accounts, column: :root_account_id
remove_foreign_key_if_exists :stream_item_instances, :users
remove_foreign_key_if_exists :submission_comments, :submissions
remove_foreign_key_if_exists :submissions, :assignments
remove_foreign_key_if_exists :user_observers, :users, column: :observer_id
remove_foreign_key_if_exists :user_observers, :users
remove_foreign_key_if_exists :user_profile_links, :user_profiles
remove_foreign_key_if_exists :user_profiles, :users
remove_foreign_key_if_exists :web_conference_participants, :web_conferences
end
end