增加索引

PCqiandao
daiao 5 years ago
parent d7dc5cfa01
commit 1ccb16f76d

@ -0,0 +1,9 @@
class AddIndexUserIdChallengeIdForGames < ActiveRecord::Migration[5.2]
def change
delete_games = Game.where.not(myshixun_id: Myshixun.all).reorder(nil)
puts "delete_games: #{delete_games.pluck(:id)}"
delete_games.destroy_all
add_index :games, [:user_id, :challenge_id], unique: true
end
end
Loading…
Cancel
Save