Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/gitlab_schema_info.rb')
-rw-r--r--lib/gitlab/database/gitlab_schema_info.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/gitlab/database/gitlab_schema_info.rb b/lib/gitlab/database/gitlab_schema_info.rb
new file mode 100644
index 00000000000..34b89cb9006
--- /dev/null
+++ b/lib/gitlab/database/gitlab_schema_info.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Database
+ GitlabSchemaInfo = Struct.new(
+ :name,
+ :description,
+ :allow_cross_joins,
+ :allow_cross_transactions,
+ :allow_cross_foreign_keys,
+ :file_path,
+ keyword_init: true
+ ) do
+ def initialize(*)
+ super
+ self.name = name.to_sym
+ self.allow_cross_joins = allow_cross_joins&.map(&:to_sym)&.freeze
+ self.allow_cross_transactions = allow_cross_transactions&.map(&:to_sym)&.freeze
+ self.allow_cross_foreign_keys = allow_cross_foreign_keys&.map(&:to_sym)&.freeze
+ end
+
+ def self.load_file(yaml_file)
+ content = YAML.load_file(yaml_file)
+ new(**content.deep_symbolize_keys.merge(file_path: yaml_file))
+ end
+ end
+ end
+end