diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-18 16:34:04 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2018-07-18 16:34:04 +0200 |
commit | 42e1080d54cf32919a5592bbdeef1857afc90783 (patch) | |
tree | bb312c77c341d9959b67ddf65325c60fcefc3924 /app/models | |
parent | 4736e0519b0d8c66ab35fd636f5f81089822ba7a (diff) | |
download | gitlab-ce-parallel-db-migrations.tar.gz |
WIP parallel DB migrationsparallel-db-migrations
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/concerns/each_batch.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/concerns/each_batch.rb b/app/models/concerns/each_batch.rb index 6ddbb8da1a9..6baa9edc263 100644 --- a/app/models/concerns/each_batch.rb +++ b/app/models/concerns/each_batch.rb @@ -38,6 +38,10 @@ module EachBatch # of - The number of rows to retrieve per batch. # column - The column to use for ordering the batches. def each_batch(of: 1000, column: primary_key) + unless block_given? + return to_enum(__method__, of: of, column: column).lazy + end + unless column raise ArgumentError, 'the column: argument must be set to a column name to use for ordering rows' |