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

20191030152934_move_limits_from_plans.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 020a028f648019e22c0352ffb2406109785781fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

class MoveLimitsFromPlans < ActiveRecord::Migration[5.2]
  DOWNTIME = false

  def up
    execute <<~SQL
      INSERT INTO plan_limits (plan_id, ci_active_pipelines, ci_pipeline_size, ci_active_jobs)
      SELECT id, COALESCE(active_pipelines_limit, 0), COALESCE(pipeline_size_limit, 0), COALESCE(active_jobs_limit, 0)
      FROM plans
    SQL
  end

  def down
    execute 'DELETE FROM plan_limits'
  end
end