Class: Gitlab::BackgroundMigration::BackfillNamespaceSettings

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/backfill_namespace_settings.rb

Overview

Backfillnamespace_settings for a range of namespaces

Instance Method Summary collapse

Instance Method Details

#perform(start_id, end_id) ⇒ Object


7
8
9
10
11
12
13
14
15
# File 'lib/gitlab/background_migration/backfill_namespace_settings.rb', line 7

def perform(start_id, end_id)
  ActiveRecord::Base.connection.execute <<~SQL
    INSERT INTO namespace_settings (namespace_id, created_at, updated_at)
      SELECT namespaces.id, now(), now()
      FROM namespaces
      WHERE namespaces.id BETWEEN #{start_id} AND #{end_id}
    ON CONFLICT (namespace_id) DO NOTHING;
  SQL
end