Skip to content
Snippets Groups Projects
Select Git revision
20 results

migration_helpers.rb

Forked from GitLab.org / GitLab FOSS
Source project has a limited visibility.
  • Yorick Peterse's avatar
    9c238dc9
    Update columns in batches until no rows are left · 9c238dc9
    Yorick Peterse authored
    Instead of updating a fixed number of rows (based on the amount of rows
    available at the start of the update) the method
    "update_column_in_batches" will now continue updating rows until it runs
    out of rows to process.
    
    For a table with a high rate of inserts this may result in the migration
    taking quite some time. However, the alternative is not all rows being
    updated or the "change_column_null" method raising an error due to there
    being NULL values.
    Verified
    9c238dc9
    History
    Update columns in batches until no rows are left
    Yorick Peterse authored
    Instead of updating a fixed number of rows (based on the amount of rows
    available at the start of the update) the method
    "update_column_in_batches" will now continue updating rows until it runs
    out of rows to process.
    
    For a table with a high rate of inserts this may result in the migration
    taking quite some time. However, the alternative is not all rows being
    updated or the "change_column_null" method raising an error due to there
    being NULL values.