summaryrefslogtreecommitdiff
path: root/db/migrate/20220722123318_update_delayed_deletion_period.rb
blob: 4d928a41259ee472bd11532d191ed0c51c77d8a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class UpdateDelayedDeletionPeriod < Gitlab::Database::Migration[2.0]
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  # Before 15.1 the only way to disable delayed deletion was to set
  # the period to 0, as of 15.1 zero is no longer a valid value (1-90).
  # This migration sets the period to a valid value and disables
  # delayed deletion using the delayed_* boolean attributes.

  def up
    execute <<~SQL
      UPDATE application_settings SET
        deletion_adjourned_period = 1,
        delayed_group_deletion = 'f',
        delayed_project_removal ='f'
      WHERE deletion_adjourned_period = 0;
    SQL
  end

  def down
    # no-op
  end
end