add foreign keys part 11
refs CNVS-6202 Change-Id: Iebe319ce5463aa862610b985f182809f2f48ad42 Reviewed-on: https://gerrit.instructure.com/24658 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Nick Cloward <ncloward@instructure.com> Reviewed-by: Anthus Williams <awilliams@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
5b9a223ed1
commit
866fb33a27
|
@ -0,0 +1,36 @@
|
|||
class AddForeignKeys11 < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def self.up
|
||||
add_foreign_key_if_not_exists :submission_comment_participants, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :submission_comments, :users, column: :author_id, delay_validation: true
|
||||
add_foreign_key_if_not_exists :submission_comments, :users, column: :recipient_id, delay_validation: true
|
||||
add_foreign_key_if_not_exists :submissions, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :user_notes, :users, column: :created_by_id, delay_validation: true
|
||||
add_foreign_key_if_not_exists :user_notes, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :web_conference_participants, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :web_conferences, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :wiki_pages, :users, delay_validation: true
|
||||
add_foreign_key_if_not_exists :conversation_messages, :conversations, delay_validation: true
|
||||
add_foreign_key_if_not_exists :conversation_message_participants, :conversation_messages, delay_validation: true
|
||||
add_foreign_key_if_not_exists :conversation_batches, :conversation_messages, column: :root_conversation_message_id, delay_validation: true
|
||||
add_foreign_key_if_not_exists :conversation_batches, :users, delay_validation: true
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_foreign_key_if_exists :submission_comment_participants, :users
|
||||
remove_foreign_key_if_exists :submission_comments, column: :author_id
|
||||
remove_foreign_key_if_exists :submission_comments, column: :recipient_id
|
||||
remove_foreign_key_if_exists :submissions, :users
|
||||
remove_foreign_key_if_exists :user_notes, column: :created_by_id
|
||||
remove_foreign_key_if_exists :user_notes, :users
|
||||
remove_foreign_key_if_exists :web_conference_participants, :users
|
||||
remove_foreign_key_if_exists :web_conferences, :users
|
||||
remove_foreign_key_if_exists :wiki_pages, :users
|
||||
remove_foreign_key_if_exists :conversation_messages, :conversations
|
||||
remove_foreign_key_if_exists :conversation_message_participants, :conversation_messages
|
||||
remove_foreign_key_if_exists :conversation_batches, column: :root_conversation_message_id
|
||||
remove_foreign_key_if_exists :conversation_batches, :users
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue