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 'lib/tasks/gitlab/db/truncate_legacy_tables.rake')
-rw-r--r--lib/tasks/gitlab/db/truncate_legacy_tables.rake31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/tasks/gitlab/db/truncate_legacy_tables.rake b/lib/tasks/gitlab/db/truncate_legacy_tables.rake
new file mode 100644
index 00000000000..9c3d7c3876d
--- /dev/null
+++ b/lib/tasks/gitlab/db/truncate_legacy_tables.rake
@@ -0,0 +1,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