Welcome to mirror list, hosted at ThFree Co, Russian Federation.

truncate_legacy_tables.rake « db « gitlab « tasks « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9c3d7c3876dd8efe21bbca0a5dc1aa674691b304 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

namespace :gitlab do
  namespace :db do
    namespace :truncate_legacy_tables do
      desc "GitLab | DB | Truncate CI Tables on Main"
      task :main, [:min_batch_size] => [:environment, 'gitlab:db:validate_config'] do |_t, args|
        args.with_defaults(min_batch_size: 5)
        Gitlab::Database::TablesTruncate.new(
          database_name: 'main',
          min_batch_size: args.min_batch_size.to_i,
          logger: Logger.new($stdout),
          dry_run: ENV['DRY_RUN'] == 'true',
          until_table: ENV['UNTIL_TABLE']
        ).execute
      end

      desc "GitLab | DB | Truncate Main Tables on CI"
      task :ci, [:min_batch_size] => [:environment, 'gitlab:db:validate_config'] do |_t, args|
        args.with_defaults(min_batch_size: 5)
        Gitlab::Database::TablesTruncate.new(
          database_name: 'ci',
          min_batch_size: args.min_batch_size.to_i,
          logger: Logger.new($stdout),
          dry_run: ENV['DRY_RUN'] == 'true',
          until_table: ENV['UNTIL_TABLE']
        ).execute
      end
    end
  end
end