Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Oct 28, 2020. It is now read-only.

Commit 66194a9

Browse files
author
v.promzelev
committed
do not retrive pk if table is empty
1 parent 20e51b7 commit 66194a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎lib/activerecord/overflow_signalizer.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ def initialize(logger: nil, models: nil, days_count: 60, signalizer: nil)
2828
def analyse!
2929
@models.group_by(&:table_name).each do |table, models|
3030
model = models.first
31-
pk = model.columns.select { |c| c.name == model.primary_key }.first
3231
next if model.last.nil?
32+
pk = model.columns.select { |c| c.name == model.primary_key }.first
3333
max = MAX_VALUE.fetch(pk.sql_type) { |type| raise UnsupportedType, type }
3434
if overflow_soon?(max, model)
3535
signalize(table, model.last.public_send(pk.name), max)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /