debian-mirror-gitlab/db/migrate/20210526190553_insert_ci_daily_pipeline_schedule_triggers_plan_limits.rb
2021-09-04 01:27:46 +05:30

27 lines
1 KiB
Ruby

# frozen_string_literal: true
class InsertCiDailyPipelineScheduleTriggersPlanLimits < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
EVERY_5_MINUTES = (1.day.in_minutes / 5).to_i
EVERY_HOUR = 1.day.in_hours.to_i
def up
return unless Gitlab.com?
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', EVERY_HOUR)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', EVERY_5_MINUTES)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', EVERY_5_MINUTES)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', EVERY_5_MINUTES)
end
def down
return unless Gitlab.com?
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'free', 0)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'bronze', 0)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'silver', 0)
create_or_update_plan_limit('ci_daily_pipeline_schedule_triggers', 'gold', 0)
end
end