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 'db/post_migrate/20230428085332_remove_shimo_zentao_integration_records.rb')
-rw-r--r--db/post_migrate/20230428085332_remove_shimo_zentao_integration_records.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20230428085332_remove_shimo_zentao_integration_records.rb b/db/post_migrate/20230428085332_remove_shimo_zentao_integration_records.rb
new file mode 100644
index 00000000000..079f1527e01
--- /dev/null
+++ b/db/post_migrate/20230428085332_remove_shimo_zentao_integration_records.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class RemoveShimoZentaoIntegrationRecords < Gitlab::Database::Migration[2.1]
+ TYPES = %w[Integrations::Shimo Integrations::Zentao]
+ BATCH_SIZE = 100
+
+ disable_ddl_transaction!
+ restrict_gitlab_migration gitlab_schema: :gitlab_main
+
+ def up
+ return if Gitlab.jh?
+
+ define_batchable_model(:integrations)
+ .where(type_new: TYPES)
+ .each_batch(of: BATCH_SIZE) { |relation, _index| relation.delete_all }
+ end
+
+ def down
+ # no-op
+ end
+end