diff options
Diffstat (limited to 'lib/gitlab/database/dictionary.rb')
-rw-r--r-- | lib/gitlab/database/dictionary.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/gitlab/database/dictionary.rb b/lib/gitlab/database/dictionary.rb index 4ef392a4e44..d963d6f288e 100644 --- a/lib/gitlab/database/dictionary.rb +++ b/lib/gitlab/database/dictionary.rb @@ -3,6 +3,8 @@ module Gitlab module Database class Dictionary + ALL_SCOPES = ['', 'views', 'deleted_tables'].freeze + def self.entries(scope = '') @entries ||= {} @entries[scope] ||= Dir.glob(dictionary_path_globs(scope)).map do |file_path| @@ -12,6 +14,15 @@ module Gitlab end end + def self.any_entry(name) + ALL_SCOPES.each do |scope| + e = entry(name, scope) + return e if e + end + + nil + end + def self.entry(name, scope = '') entries(scope).find do |entry| entry.key_name == name @@ -69,6 +80,10 @@ module Gitlab data['classes'] end + def allow_cross_to_schemas(type) + data["allow_cross_#{type}"].to_a.map(&:to_sym) + end + def schema?(schema_name) gitlab_schema == schema_name.to_s end |