Commit 8c5fba55 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'allow_old_cross_join_background_migration' into 'master'

Allow old background migration that does cross-DB query

See merge request gitlab-org/gitlab!72254
parents bb37efa6 b7d1217d
...@@ -9,6 +9,8 @@ module EE ...@@ -9,6 +9,8 @@ module EE
override :perform override :perform
def perform(start_id, stop_id) def perform(start_id, stop_id)
# Introduced in GitLab 12.9, will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/33124
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/331248') do
execute <<~SQL execute <<~SQL
INSERT INTO security_scans (created_at, updated_at, build_id, scan_type) INSERT INTO security_scans (created_at, updated_at, build_id, scan_type)
SELECT ci_job_artifacts.created_at, ci_job_artifacts.updated_at, ci_job_artifacts.job_id, ci_job_artifacts.file_type - 4 SELECT ci_job_artifacts.created_at, ci_job_artifacts.updated_at, ci_job_artifacts.job_id, ci_job_artifacts.file_type - 4
...@@ -18,6 +20,7 @@ module EE ...@@ -18,6 +20,7 @@ module EE
ON CONFLICT (build_id, scan_type) DO NOTHING; ON CONFLICT (build_id, scan_type) DO NOTHING;
SQL SQL
end end
end
def execute(sql) def execute(sql)
@connection ||= ::ActiveRecord::Base.connection @connection ||= ::ActiveRecord::Base.connection
......
...@@ -38,8 +38,11 @@ module EE ...@@ -38,8 +38,11 @@ module EE
AND "vulnerability_feedback"."project_id" = "pipelines_with_reports"."project_id"; AND "vulnerability_feedback"."project_id" = "pipelines_with_reports"."project_id";
SQL SQL
# Introduced in GitLab 13.6, will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/331248
::Gitlab::Database.allow_cross_joins_across_databases(url: 'https://gitlab.com/gitlab-org/gitlab/-/issues/331248') do
connection.execute(update_feedback_pipeline_id_sql) connection.execute(update_feedback_pipeline_id_sql)
end end
end
def pipelines_with_security_reports_subquery(project_ids) def pipelines_with_security_reports_subquery(project_ids)
<<~SQL <<~SQL
......
...@@ -9,11 +9,9 @@ ...@@ -9,11 +9,9 @@
- "./ee/spec/finders/ee/namespaces/projects_finder_spec.rb" - "./ee/spec/finders/ee/namespaces/projects_finder_spec.rb"
- "./ee/spec/graphql/ee/resolvers/namespace_projects_resolver_spec.rb" - "./ee/spec/graphql/ee/resolvers/namespace_projects_resolver_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules_spec.rb" - "./ee/spec/lib/ee/gitlab/background_migration/migrate_approver_to_approval_rules_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/migrate_security_scans_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids_spec.rb" - "./ee/spec/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column_spec.rb" - "./ee/spec/lib/ee/gitlab/background_migration/populate_resolved_on_default_branch_column_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb" - "./ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb"
- "./ee/spec/lib/ee/gitlab/background_migration/populate_vulnerability_feedback_pipeline_id_spec.rb"
- "./ee/spec/lib/ee/gitlab/usage_data_spec.rb" - "./ee/spec/lib/ee/gitlab/usage_data_spec.rb"
- "./ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb" - "./ee/spec/migrations/schedule_populate_resolved_on_default_branch_column_spec.rb"
- "./ee/spec/models/ci/build_spec.rb" - "./ee/spec/models/ci/build_spec.rb"
......
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