Commit 1a0140e7 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'issue_350090' into 'master'

Moving gitlab_loose_foreign_key to config/ directory

See merge request gitlab-org/gitlab!80064
parents 8c23ea61 b29a0383
......@@ -61,7 +61,7 @@ following information:
- Child table name (`ci_pipelines`)
- The data cleanup method (`async_delete` or `async_nullify`)
The YAML file is located at `lib/gitlab/database/gitlab_loose_foreign_keys.yml`. The file groups
The YAML file is located at `config/gitlab_loose_foreign_keys.yml`. The file groups
foreign key definitions by the name of the child table. The child table can have multiple loose
foreign key definitions, therefore we store them as an array.
......
......@@ -32,7 +32,7 @@ module Gitlab
end
def self.loose_foreign_keys_yaml_path
@loose_foreign_keys_yaml_path ||= Rails.root.join('lib/gitlab/database/gitlab_loose_foreign_keys.yml')
@loose_foreign_keys_yaml_path ||= Rails.root.join('config/gitlab_loose_foreign_keys.yml')
end
private_class_method :build_definition
......
......@@ -107,7 +107,7 @@ def columns(*args)
end
def add_definition_to_yaml(definition)
content = YAML.load_file(Rails.root.join('lib/gitlab/database/gitlab_loose_foreign_keys.yml'))
content = YAML.load_file(Rails.root.join('config/gitlab_loose_foreign_keys.yml'))
table_definitions = content[definition.from_table]
# insert new entry at random place to avoid conflicts
......@@ -148,11 +148,11 @@ def add_definition_to_yaml(definition)
# emulate existing formatting
File.write(
Rails.root.join('lib/gitlab/database/gitlab_loose_foreign_keys.yml'),
Rails.root.join('config/gitlab_loose_foreign_keys.yml'),
content.to_yaml.gsub(/^([- ] )/, ' \1')
)
exec_cmd("git", "add", "lib/gitlab/database/gitlab_loose_foreign_keys.yml")
exec_cmd("git", "add", "config/gitlab_loose_foreign_keys.yml")
end
def generate_migration(definition)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment