summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-27 02:11:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-27 02:11:07 +0000
commita082c45f16bf30bef6e82defa75901375287d467 (patch)
tree13b1fe8ce4a1023ccd23b1e4875ecf944e368098
parented3ba0d93b5d0dc92a6d62edc80b9727cbbf4d7b (diff)
downloadgitlab-ce-a082c45f16bf30bef6e82defa75901375287d467.tar.gz
Add latest changes from gitlab-org/gitlab@15-10-stable-ee
-rw-r--r--db/post_migrate/20230310213308_sync_security_policy_rule_schedules_that_may_have_been_deleted_by_a_bug.rb37
-rw-r--r--db/schema_migrations/202303102133081
2 files changed, 38 insertions, 0 deletions
diff --git a/db/post_migrate/20230310213308_sync_security_policy_rule_schedules_that_may_have_been_deleted_by_a_bug.rb b/db/post_migrate/20230310213308_sync_security_policy_rule_schedules_that_may_have_been_deleted_by_a_bug.rb
new file mode 100644
index 00000000000..3435f889fa7
--- /dev/null
+++ b/db/post_migrate/20230310213308_sync_security_policy_rule_schedules_that_may_have_been_deleted_by_a_bug.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+class SyncSecurityPolicyRuleSchedulesThatMayHaveBeenDeletedByABug < Gitlab::Database::Migration[2.1]
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ class OrchestrationPolicyRuleSchedule < MigrationRecord
+ self.table_name = 'security_orchestration_policy_rule_schedules'
+ end
+
+ def up
+ return unless Gitlab.ee?
+ return unless sync_scan_policies_worker
+
+ OrchestrationPolicyRuleSchedule
+ .select(:security_orchestration_policy_configuration_id)
+ .distinct
+ .where(policy_index: 1..)
+ .pluck(:security_orchestration_policy_configuration_id)
+ .map { |policy_configuration_id| [policy_configuration_id] }
+ .then { |args_list| sync_scan_policies_worker.bulk_perform_async(args_list) }
+ end
+
+ def down
+ # no-op
+ end
+
+ private
+
+ def sync_scan_policies_worker
+ unless defined?(@sync_scan_policies_worker)
+ @sync_scan_policies_worker = 'Security::SyncScanPoliciesWorker'.safe_constantize
+ end
+
+ @sync_scan_policies_worker
+ end
+end
diff --git a/db/schema_migrations/20230310213308 b/db/schema_migrations/20230310213308
new file mode 100644
index 00000000000..807a1141109
--- /dev/null
+++ b/db/schema_migrations/20230310213308
@@ -0,0 +1 @@
+e6bd8bddb33ee72a183da7381bc599b98db03fdf3de6bc20860fe3b119d5a6a2 \ No newline at end of file