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 'spec/support/database/gitlab_schema.rb')
-rw-r--r--spec/support/database/gitlab_schema.rb11
1 files changed, 3 insertions, 8 deletions
diff --git a/spec/support/database/gitlab_schema.rb b/spec/support/database/gitlab_schema.rb
index fe05fb998e6..22f997e70e1 100644
--- a/spec/support/database/gitlab_schema.rb
+++ b/spec/support/database/gitlab_schema.rb
@@ -9,17 +9,12 @@ module Database
end
def self.table_schema(name)
- tables_to_schema[name] || :undefined
+ # When undefined it's best to return a unique name so that we don't incorrectly assume that 2 undefined schemas belong on the same database
+ tables_to_schema[name] || :"undefined_#{name}"
end
def self.tables_to_schema
- @tables_to_schema ||= all_classes_with_schema.to_h do |klass|
- [klass.table_name, klass.gitlab_schema]
- end
- end
-
- def self.all_classes_with_schema
- ActiveRecord::Base.descendants.reject(&:abstract_class?).select(&:gitlab_schema?) # rubocop:disable Database/MultipleDatabases
+ @tables_to_schema ||= YAML.load_file(Rails.root.join('spec/support/database/gitlab_schemas.yml'))
end
end
end