Class: Gitlab::Database::CustomStructure

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/database/custom_structure.rb

Constant Summary collapse

CUSTOM_DUMP_FILE =
'db/gitlab_structure.sql'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.custom_dump_filepathObject


18
19
20
# File 'lib/gitlab/database/custom_structure.rb', line 18

def self.custom_dump_filepath
  Rails.root.join(CUSTOM_DUMP_FILE)
end

Instance Method Details

#dumpObject


8
9
10
11
12
13
14
15
16
# File 'lib/gitlab/database/custom_structure.rb', line 8

def dump
  File.open(self.class.custom_dump_filepath, 'wb') do |io|
    io << "-- this file tracks custom GitLab data, such as foreign keys referencing partitioned tables\n"
    io << "-- more details can be found in the issue: https://gitlab.com/gitlab-org/gitlab/-/issues/201872\n"
    io << "SET search_path=public;\n\n"

    dump_partitioned_foreign_keys(io) if partitioned_foreign_keys_exist?
  end
end