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

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

class RemoveAdditionalApplicationSettingsRows < ActiveRecord::Migration[6.0]
  class ApplicationSetting < ActiveRecord::Base
    self.table_name = 'application_settings'
  end

  def up
    return if ApplicationSetting.count == 1

    execute "DELETE from application_settings WHERE id NOT IN (SELECT MAX(id) FROM application_settings);"
  end

  def down
    # no changes
  end
end