diff options
author | Phil Hughes <me@iamphill.com> | 2017-08-30 11:20:34 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-08-30 11:20:34 +0100 |
commit | 75c4d2659bbcd51efc44123f3ab2c6496fa0eee2 (patch) | |
tree | 3b64f1f2d6c532c4472be1ff50662774a3299fa6 /lib/gitlab/database/migration_helpers.rb | |
parent | a8460f215cc1949b993e774dc00bad0b506abcfa (diff) | |
parent | 978b4b9cc0374c9cb5680612fe4154f393bbba9c (diff) | |
download | gitlab-ce-75c4d2659bbcd51efc44123f3ab2c6496fa0eee2.tar.gz |
Merge branch 'master' into breadcrumbs-improvements
Diffstat (limited to 'lib/gitlab/database/migration_helpers.rb')
-rw-r--r-- | lib/gitlab/database/migration_helpers.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/database/migration_helpers.rb b/lib/gitlab/database/migration_helpers.rb index 69ca9aa596b..5e2c6cc5cad 100644 --- a/lib/gitlab/database/migration_helpers.rb +++ b/lib/gitlab/database/migration_helpers.rb @@ -606,6 +606,25 @@ module Gitlab Arel::Nodes::SqlLiteral.new(replace.to_sql) end end + + def remove_foreign_key_without_error(*args) + remove_foreign_key(*args) + rescue ArgumentError + end + + def sidekiq_queue_migrate(queue_from, to:) + while sidekiq_queue_length(queue_from) > 0 + Sidekiq.redis do |conn| + conn.rpoplpush "queue:#{queue_from}", "queue:#{to}" + end + end + end + + def sidekiq_queue_length(queue_name) + Sidekiq.redis do |conn| + conn.llen("queue:#{queue_name}") + end + end end end end |