more fk indexes
also fix an old migration that should have ran on all shards Change-Id: Ib4305c4f1b84ba0cfd525d0f552cfc21d365dc24 Reviewed-on: https://gerrit.instructure.com/37492 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Reviewed-by: Brian Palmer <brianp@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
parent
4872ee008e
commit
9b1e8c7350
|
@ -2,14 +2,12 @@ class AddUniqueIndexOnNotifications < ActiveRecord::Migration
|
|||
tag :postdeploy
|
||||
|
||||
def self.up
|
||||
return unless Shard.current.default?
|
||||
# the excess subquery is necessary to avoid error 1093 on mysql
|
||||
Notification.where("id NOT IN (SELECT * FROM (SELECT MIN(id) FROM notifications GROUP BY name) x)").delete_all
|
||||
add_index :notifications, [:name], :unique => true, :name => "index_notifications_unique_on_name"
|
||||
end
|
||||
|
||||
def self.down
|
||||
return unless Shard.current.default?
|
||||
remove_index :notifications, :name => "index_notifications_unique_on_name"
|
||||
end
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
class AddForeignKeyIndexes3 < ActiveRecord::Migration
|
||||
tag :postdeploy
|
||||
disable_ddl_transaction!
|
||||
|
||||
def self.up
|
||||
add_index :account_reports, :attachment_id, algorithm: :concurrently
|
||||
add_index :zip_file_imports, :attachment_id, algorithm: :concurrently
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :account_reports, :attachment_id
|
||||
remove_index :zip_file_imports, :attachment_id
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue