Class: Gitlab::Database::BackgroundMigrationJob

Inherits:
SharedModel
  • Object
show all
Includes:
BulkInsertSafe, EachBatch
Defined in:
lib/gitlab/database/background_migration_job.rb

Constant Summary

Constants included from BulkInsertSafe

BulkInsertSafe::ALLOWED_CALLBACKS, BulkInsertSafe::DEFAULT_BATCH_SIZE, BulkInsertSafe::MethodNotAllowedError, BulkInsertSafe::PrimaryKeySetError

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SharedModel

connection, #connection_db_config, using_connection

Class Method Details

.mark_all_as_succeeded(class_name, arguments) ⇒ Object


25
26
27
28
# File 'lib/gitlab/database/background_migration_job.rb', line 25

def self.mark_all_as_succeeded(class_name, arguments)
  self.pending.for_migration_execution(class_name, arguments)
    .update_all("status = #{statuses[:succeeded]}, updated_at = NOW()")
end

.normalize_class_name(class_name) ⇒ Object


30
31
32
33
34
# File 'lib/gitlab/database/background_migration_job.rb', line 30

def self.normalize_class_name(class_name)
  return class_name unless class_name.present? && class_name.start_with?('::')

  class_name[2..]
end

Instance Method Details

#class_name=(value) ⇒ Object


36
37
38
# File 'lib/gitlab/database/background_migration_job.rb', line 36

def class_name=(value)
  write_attribute(:class_name, self.class.normalize_class_name(value))
end