migration fixups

make this data fix postdeploy, and avoid find_in_batches issues
also remove :concurrently from a index created transactionally (on a new table)

Change-Id: If9744e13b2387eb1a310f19629fff6327000add5
Reviewed-on: https://gerrit.instructure.com/19834
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
This commit is contained in:
Brian Palmer 2013-04-19 15:42:12 -06:00
parent ff85faf46a
commit 59841e884c
3 changed files with 17 additions and 15 deletions

View File

@ -1,5 +1,5 @@
class AddManageRubricsPermission < ActiveRecord::Migration
tag :predeploy
tag :postdeploy
def self.up
DataFixup::CopyRoleOverrides.send_later_if_production_enqueue_args(:run,

View File

@ -14,7 +14,7 @@ class CreateMigrationIssues < ActiveRecord::Migration
t.timestamps
end
add_index :migration_issues, :content_migration_id, :concurrently => true
add_index :migration_issues, :content_migration_id
end
def self.down

View File

@ -1,6 +1,7 @@
module DataFixup::CopyRoleOverrides
def self.run(old_permission, new_permission)
RoleOverride.where(:permission => old_permission.to_s).find_in_batches do |old_role_overrides|
RoleOverride.send(:with_exclusive_scope) do
possible_new_role_overrides = RoleOverride.find(:all, :conditions =>
{:permission => new_permission.to_s, :context_id => old_role_overrides.map(&:context_id)} )
@ -21,4 +22,5 @@ module DataFixup::CopyRoleOverrides
end
end
end
end
end