diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-04-30 17:00:28 +0400 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-04-30 17:01:35 +0400 |
commit | 0d30b00de807df550bec947751c098317c5bb79f (patch) | |
tree | fa9ed7849bcaf0ed07a96143ef72d9a1018c730d /db/post_migrate | |
parent | 3dbcc02db0c1fda22044a743158d4ba9e4eda637 (diff) | |
download | gitlab-ce-0d30b00de807df550bec947751c098317c5bb79f.tar.gz |
Start persisting runner_type when creating runners
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb b/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb new file mode 100644 index 00000000000..8509222edc2 --- /dev/null +++ b/db/post_migrate/20180430143705_backfill_runner_type_for_ci_runners_post_migrate.rb @@ -0,0 +1,20 @@ +class BackfillRunnerTypeForCiRunnersPostMigrate < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:ci_runners, :runner_type, 1) do |table, query| + query.where(table[:is_shared].eq(true)).where(table[:runner_type].eq(nil)) + end + + update_column_in_batches(:ci_runners, :runner_type, 3) do |table, query| + query.where(table[:is_shared].eq(false)).where(table[:runner_type].eq(nil)) + end + end + + def down + end +end |