Last active
December 11, 2015 16:48
-
-
Save marciok/4629969 to your computer and use it in GitHub Desktop.
Commands to clean the data base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Para deletar o conteudo de dentro da variavel | |
b.map(&:delete) | |
# Comando para tirar o heroku da manuntenção para ser executado no terminal: heroku maintenance:off -a battle-server-mock | |
# Scritpt que o Erich me passou | |
count = 0 | |
total = 0 | |
ids = Challenge.all.map(&:id) | |
Battle.nin(challenge_id: ids).batch_size(1000).no_timeout.each do |battle| | |
unless battle.valid? | |
battle.delete | |
puts "Deleted: #{count += 1}" | |
end | |
total += 1 | |
puts "Total: #{total}" if total % 1000 == 0 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment