aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAlex Kitchens <alexcameron98@gmail.com>2019-03-12 20:07:27 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2019-03-12 18:07:27 -0700
commit18ff6020b96a447f89cfafd109c9a7cf11f05bfb (patch)
tree3533e7601bc598362574692e5f7094f30e89006e /activerecord
parent963ec3bae5ac12ab3e0614bdd0d0ca9fba06ac46 (diff)
downloadrails-18ff6020b96a447f89cfafd109c9a7cf11f05bfb.tar.gz
rails-18ff6020b96a447f89cfafd109c9a7cf11f05bfb.tar.bz2
rails-18ff6020b96a447f89cfafd109c9a7cf11f05bfb.zip
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`.
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/relation.rb4
1 files changed, 4 insertions, 0 deletions
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