Commit 6fb28081 authored by Ethan Urie's avatar Ethan Urie

Merge branch '350190-verify-or-fix-usages-of-activerecord-base-in-pseudonymizer' into 'master'

Annotate usages of ActiveRecord:Base in Pseudonymizer

See merge request gitlab-org/gitlab!81491
parents dfd5e40a d452c7e8
...@@ -5,9 +5,6 @@ Database/MultipleDatabases: ...@@ -5,9 +5,6 @@ Database/MultipleDatabases:
- ee/lib/gitlab/geo/geo_tasks.rb - ee/lib/gitlab/geo/geo_tasks.rb
- ee/lib/gitlab/geo/health_check.rb - ee/lib/gitlab/geo/health_check.rb
- ee/lib/gitlab/geo/log_cursor/daemon.rb - ee/lib/gitlab/geo/log_cursor/daemon.rb
- ee/lib/pseudonymizer/dumper.rb
- ee/lib/pseudonymizer/pager.rb
- ee/spec/lib/pseudonymizer/dumper_spec.rb
- ee/spec/services/ee/merge_requests/update_service_spec.rb - ee/spec/services/ee/merge_requests/update_service_spec.rb
- lib/backup/database.rb - lib/backup/database.rb
- lib/backup/manager.rb - lib/backup/manager.rb
......
...@@ -77,6 +77,9 @@ module Pseudonymizer ...@@ -77,6 +77,9 @@ module Pseudonymizer
end.lazy end.lazy
end end
# Disable rubocop Database/MultipleDatabases cop until Pseudonymizer is removed
# See https://gitlab.com/gitlab-org/gitlab/-/issues/350190
# rubocop:disable Database/MultipleDatabases
def table_to_schema(table) def table_to_schema(table)
table_config = @config.dig(:tables, table) table_config = @config.dig(:tables, table)
...@@ -97,6 +100,7 @@ module Pseudonymizer ...@@ -97,6 +100,7 @@ module Pseudonymizer
set_schema_column_types(table, type_results) set_schema_column_types(table, type_results)
end end
# rubocop:enable Database/MultipleDatabases
def set_schema_column_types(table, type_results) def set_schema_column_types(table, type_results)
has_id = type_results.any? {|c| c[:name] == "id" } has_id = type_results.any? {|c| c[:name] == "id" }
......
...@@ -19,6 +19,9 @@ module Pseudonymizer ...@@ -19,6 +19,9 @@ module Pseudonymizer
end end
end end
# Disable rubocop Database/MultipleDatabases cop until Pseudonymizer is removed
# See https://gitlab.com/gitlab-org/gitlab/-/issues/350190
# rubocop:disable Database/MultipleDatabases
def pages_per_id(&block) def pages_per_id(&block)
id_offset = 0 id_offset = 0
...@@ -40,7 +43,11 @@ module Pseudonymizer ...@@ -40,7 +43,11 @@ module Pseudonymizer
break if results.count < PAGE_SIZE break if results.count < PAGE_SIZE
end end
end end
# rubocop:enable Database/MultipleDatabases
# Disable rubocop Database/MultipleDatabases cop until Pseudonymizer is removed
# See https://gitlab.com/gitlab-org/gitlab/-/issues/350190
# rubocop:disable Database/MultipleDatabases
def pages_per_offset(&block) def pages_per_offset(&block)
offset = 0 offset = 0
...@@ -61,5 +68,6 @@ module Pseudonymizer ...@@ -61,5 +68,6 @@ module Pseudonymizer
break if results.count < PAGE_SIZE break if results.count < PAGE_SIZE
end end
end end
# rubocop:enable Database/MultipleDatabases
end end
end end
...@@ -102,6 +102,9 @@ RSpec.describe Pseudonymizer::Dumper do ...@@ -102,6 +102,9 @@ RSpec.describe Pseudonymizer::Dumper do
end end
end end
# Disable rubocop Database/MultipleDatabases cop until Pseudonymizer is removed
# See https://gitlab.com/gitlab-org/gitlab/-/issues/350190
# rubocop:disable Database/MultipleDatabases
describe "manifest is valid" do describe "manifest is valid" do
it "all tables exist" do it "all tables exist" do
existing_tables = ActiveRecord::Base.connection.tables existing_tables = ActiveRecord::Base.connection.tables
...@@ -130,4 +133,5 @@ RSpec.describe Pseudonymizer::Dumper do ...@@ -130,4 +133,5 @@ RSpec.describe Pseudonymizer::Dumper do
end end
end end
end end
# rubocop:enable Database/MultipleDatabases
end end
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