Skip to content

Commit

Permalink
Merge pull request #2629 from manyfold3d/speed-up-migration
Browse files Browse the repository at this point in the history
Speed up public ID migration
  • Loading branch information
Floppy authored Sep 5, 2024
2 parents e657d14 + d6a64a8 commit d0476c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/data/20240904152358_generate_public_i_ds_for_models.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
class GeneratePublicIDsForModels < ActiveRecord::Migration[7.1]
def up
[Model, ModelFile, Problem, Creator, Collection, Library].each do |model|
model.find_each do |obj|
model.where(public_id: nil).find_each do |obj|
obj.send :generate_public_id
obj.save! validate: false
obj.update_column :public_id, obj.public_id # rubocop:disable Rails/SkipsModelValidations
end
end
end
Expand Down

0 comments on commit d0476c6

Please sign in to comment.