Class: Gitlab::Database::AlterCellSequencesRange
- Inherits:
-
Object
- Object
- Gitlab::Database::AlterCellSequencesRange
- Defined in:
- lib/gitlab/database/alter_cell_sequences_range.rb
Constant Summary collapse
- MISSING_LIMIT_MSG =
'Either minval or maxval is required to alter sequence range'
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#maxval ⇒ Object
readonly
Returns the value of attribute maxval.
-
#minval ⇒ Object
readonly
Returns the value of attribute minval.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(minval, maxval, connection, logger: Gitlab::AppLogger) ⇒ AlterCellSequencesRange
constructor
A new instance of AlterCellSequencesRange.
Constructor Details
#initialize(minval, maxval, connection, logger: Gitlab::AppLogger) ⇒ AlterCellSequencesRange
Returns a new instance of AlterCellSequencesRange.
10 11 12 13 14 15 16 17 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 10 def initialize(minval, maxval, connection, logger: Gitlab::AppLogger) raise MISSING_LIMIT_MSG unless minval.present? || maxval.present? @minval = minval @maxval = maxval @connection = connection @logger = logger end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
8 9 10 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 8 def connection @connection end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
8 9 10 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 8 def logger @logger end |
#maxval ⇒ Object (readonly)
Returns the value of attribute maxval.
8 9 10 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 8 def maxval @maxval end |
#minval ⇒ Object (readonly)
Returns the value of attribute minval.
8 9 10 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 8 def minval @minval end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/gitlab/database/alter_cell_sequences_range.rb', line 19 def execute sequences.each do |sequence| with_lock_retries do connection.execute(alter_sequence_query(sequence.seq_name)) logger.info("Altered cell sequence #{sequence.seq_name}. Updated with (#{minval}, #{maxval})") end end end |