gitlab-org--gitlab-foss/db/post_migrate/20200420162730_remove_addit...

18 lines
414 B
Ruby

# 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