Class: Gitlab::Database::BumpSequences
- Inherits:
-
Object
- Object
- Gitlab::Database::BumpSequences
- Defined in:
- lib/gitlab/database/bump_sequences.rb
Constant Summary collapse
- SEQUENCE_NAME_MATCHER =
/nextval\('([a-z_]+)'::regclass\)/
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(gitlab_schema, increase_by, base_model = ApplicationRecord) ⇒ BumpSequences
constructor
gitlab_schema: can be ‘gitlab_main’, ‘gitlab_ci’, ‘gitlab_main_cell’, ‘gitlab_shared’ increase_by: positive number, to increase the sequence by base_model: is to choose which connection to use to query the tables.
Constructor Details
#initialize(gitlab_schema, increase_by, base_model = ApplicationRecord) ⇒ BumpSequences
gitlab_schema: can be ‘gitlab_main’, ‘gitlab_ci’, ‘gitlab_main_cell’, ‘gitlab_shared’ increase_by: positive number, to increase the sequence by base_model: is to choose which connection to use to query the tables
11 12 13 14 15 |
# File 'lib/gitlab/database/bump_sequences.rb', line 11 def initialize(gitlab_schema, increase_by, base_model = ApplicationRecord) @base_model = base_model @gitlab_schema = gitlab_schema @increase_by = increase_by end |
Instance Method Details
#execute ⇒ Object
17 18 19 20 21 |
# File 'lib/gitlab/database/bump_sequences.rb', line 17 def execute sequences_by_gitlab_schema(base_model, gitlab_schema).each do |sequence_name| increment_sequence_by(base_model.connection, sequence_name, increase_by) end end |