diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-06-18 14:18:50 +0300 |
commit | 8c7f4e9d5f36cff46365a7f8c4b9c21578c1e781 (patch) | |
tree | a77e7fe7a93de11213032ed4ab1f33a3db51b738 /app/models/internal_id.rb | |
parent | 00b35af3db1abfe813a778f643dad221aad51fca (diff) |
Add latest changes from gitlab-org/gitlab@13-1-stable-ee
Diffstat (limited to 'app/models/internal_id.rb')
-rw-r--r-- | app/models/internal_id.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/app/models/internal_id.rb b/app/models/internal_id.rb index b6882701e23..21cf6bfa414 100644 --- a/app/models/internal_id.rb +++ b/app/models/internal_id.rb @@ -25,8 +25,6 @@ class InternalId < ApplicationRecord validates :usage, presence: true - REQUIRED_SCHEMA_VERSION = 20180305095250 - # Increments #last_value and saves the record # # The operation locks the record and gathers a `ROW SHARE` lock (in PostgreSQL). @@ -63,24 +61,16 @@ class InternalId < ApplicationRecord class << self def track_greatest(subject, scope, usage, new_value, init) - return new_value unless available? - InternalIdGenerator.new(subject, scope, usage) .track_greatest(init, new_value) end def generate_next(subject, scope, usage, init) - # Shortcut if `internal_ids` table is not available (yet) - # This can be the case in other (unrelated) migration specs - return (init.call(subject) || 0) + 1 unless available? - InternalIdGenerator.new(subject, scope, usage) .generate(init) end def reset(subject, scope, usage, value) - return false unless available? - InternalIdGenerator.new(subject, scope, usage) .reset(value) end @@ -95,20 +85,6 @@ class InternalId < ApplicationRecord where(filter).delete_all end - - def available? - return true unless Rails.env.test? - - Gitlab::SafeRequestStore.fetch(:internal_ids_available_flag) do - ActiveRecord::Migrator.current_version >= REQUIRED_SCHEMA_VERSION - end - end - - # Flushes cached information about schema - def reset_column_information - Gitlab::SafeRequestStore[:internal_ids_available_flag] = nil - super - end end class InternalIdGenerator |