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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 21:10:07 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-08-18 21:10:07 +0300
commitbc7374e61208637f6fb116e2ca59c7162b07cba9 (patch)
treed34a9d8680f808bd327123ebb2c861071f1e7635 /app/finders
parentc48bbe6650648fa034696de25983418981e695eb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/database/batched_background_migrations_finder.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/finders/database/batched_background_migrations_finder.rb b/app/finders/database/batched_background_migrations_finder.rb
new file mode 100644
index 00000000000..866acd47238
--- /dev/null
+++ b/app/finders/database/batched_background_migrations_finder.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+module Database
+ class BatchedBackgroundMigrationsFinder
+ RETURNED_MIGRATIONS = 20
+
+ def initialize(connection:)
+ @connection = connection
+ end
+
+ def execute
+ batched_migration_class.ordered_by_created_at_desc.for_gitlab_schema(schema).limit(RETURNED_MIGRATIONS)
+ end
+
+ private
+
+ attr_accessor :connection
+
+ def batched_migration_class
+ Gitlab::Database::BackgroundMigration::BatchedMigration
+ end
+
+ def schema
+ Gitlab::Database.gitlab_schemas_for_connection(connection)
+ end
+ end
+end