gitlab-org--gitlab-foss/db/migrate/20220413054910_backfill_delayed_group_deletion.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
575 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class BackfillDelayedGroupDeletion < Gitlab::Database::Migration[1.0]
class ApplicationSetting < ActiveRecord::Base
self.table_name = 'application_settings'
end
def up
ApplicationSetting.reset_column_information
ApplicationSetting.find_each do |application_setting|
application_setting.update!(delayed_group_deletion: application_setting.deletion_adjourned_period > 0)
end
end
def down
ApplicationSetting.reset_column_information
ApplicationSetting.update_all(delayed_group_deletion: true)
end
end