Fix edge case in migration helpers that caused crash because of PostgreSQL quirks (#17398)
This commit is contained in:
parent
ad06423e71
commit
5ec943f85d
1 changed files with 1 additions and 1 deletions
|
@ -329,7 +329,7 @@ module Mastodon
|
||||||
table = Arel::Table.new(table_name)
|
table = Arel::Table.new(table_name)
|
||||||
|
|
||||||
total = estimate_rows_in_table(table_name).to_i
|
total = estimate_rows_in_table(table_name).to_i
|
||||||
if total == 0
|
if total < 1
|
||||||
count_arel = table.project(Arel.star.count.as('count'))
|
count_arel = table.project(Arel.star.count.as('count'))
|
||||||
count_arel = yield table, count_arel if block_given?
|
count_arel = yield table, count_arel if block_given?
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue