From 18ff6020b96a447f89cfafd109c9a7cf11f05bfb Mon Sep 17 00:00:00 2001 From: Alex Kitchens Date: Tue, 12 Mar 2019 20:07:27 -0500 Subject: Document int Primary Key with create_or_find_by (#35573) This commit addresses the issue in https://github.com/rails/rails/issues/35543 by making note of the growing primary key issue with `create_or_find_by`. --- activerecord/lib/active_record/relation.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index d612ff53c1..ab50972e06 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -197,6 +197,10 @@ module ActiveRecord # if a DELETE between those two statements is run by another client. But for most applications, # that's a significantly less likely condition to hit. # * It relies on exception handling to handle control flow, which may be marginally slower. + # * The primary key may auto-increment on each create, even if it fails. This can accelerate + # the problem of running out of integers, if the underlying table is still stuck on a primary + # key of type int (note: All Rails apps since 5.0+ have defaulted to bigint, which is not liable + # to this problem). # # This method will return a record if all given attributes are covered by unique constraints # (unless the INSERT -> DELETE -> SELECT race condition is triggered), but if creation was attempted -- cgit v1.2.3