Created
October 23, 2018 20:40
-
-
Save pnispel/4502dbf8854b2d623005fd1aa6f52aad to your computer and use it in GitHub Desktop.
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
batch_size = 1000 | |
start_id = LoginInformation.minimum(LoginInformation.primary_key) || 0 | |
max_id = LoginInformation.maximum(LoginInformation.primary_key) || 0 | |
end_id = [start_id + batch_size, max_id].min | |
while start_id <= max_id | |
LoginInformation.where("login_informations.id BETWEEN #{start_id} and #{end_id} AND temp_id_uuid_mappings.id = login_informations.id").update_all("uuid = temp_id_uuid_mappings.uuid FROM temp_id_uuid_mappings") | |
start_id += batch_size | |
end_id = [start_id + batch_size, max_id].min | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment