add submissions.quiz_submission_id fk

Change-Id: I9bbfaf513d4632129f5368a25cb3bd329e5eb47c
Reviewed-on: https://gerrit.instructure.com/53094
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2015-04-29 08:35:01 -06:00
parent 0816b52529
commit 54686f0cea
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
class AddSubmissionsQuizSubmissionsForeignKey < ActiveRecord::Migration
tag :postdeploy
disable_ddl_transaction!
def up
add_index :submissions, :quiz_submission_id, where: "quiz_submission_id IS NOT NULL", algorithm: :concurrently
add_foreign_key :submissions, :quiz_submissions, delay_validation: true
end
def down
remove_foreign_key :submissions, :quiz_submissions
remove_index :submissions, :quiz_submission_id
end
end