fix index migration for mysql build

closes CNVS-9674
test plan
 - migrations should not fail

Change-Id: I9acb8cb20b33bcdb2318fcaab894ac8f7c4c2c8f
Reviewed-on: https://gerrit.instructure.com/26658
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
This commit is contained in:
Rob Orton 2013-11-25 14:09:13 -07:00
parent 2e9192ee7c
commit 95f58a2840
1 changed files with 7 additions and 2 deletions

View File

@ -3,7 +3,7 @@ class AddAssociationToLearningOutcomeResultsIndex < ActiveRecord::Migration
disable_ddl_transaction!
def self.up
remove_index :learning_outcome_results, name: "index_learning_outcome_results_association"
rename_index :learning_outcome_results, 'index_learning_outcome_results_association', 'temp_index_learning_outcome'
LearningOutcomeResult.
select("user_id, content_tag_id, association_id, association_type,
associated_asset_id, associated_asset_type").
@ -20,7 +20,12 @@ class AddAssociationToLearningOutcomeResultsIndex < ActiveRecord::Migration
keeper = scope.order("updated_at DESC").first
scope.where("id<>?", keeper).delete_all
end
add_index :learning_outcome_results, [:user_id, :content_tag_id, :association_id, :association_type, :associated_asset_id, :associated_asset_type], unique: true, name: "index_learning_outcome_results_association", algorithm: :concurrently
add_index :learning_outcome_results,
[:user_id, :content_tag_id, :association_id, :association_type, :associated_asset_id, :associated_asset_type],
unique: true,
name: "index_learning_outcome_results_association",
algorithm: :concurrently
remove_index :learning_outcome_results, name: "temp_index_learning_outcome"
end
def self.down