summaryrefslogtreecommitdiff
path: root/db/migrate/20210212153934_make_the_geo_oauth_application_trusted_by_default.rb
blob: ab0343887e42f9993042ed4c6002f74d222fb00f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class MakeTheGeoOauthApplicationTrustedByDefault < ActiveRecord::Migration[6.0]
  DOWNTIME = false

  def up
    execute(<<-SQL.squish)
      UPDATE oauth_applications
      SET confidential = true, trusted = true
      WHERE id IN (SELECT oauth_application_id FROM geo_nodes);
    SQL
  end

  def down
    # We won't be able to tell which trusted applications weren't
    # confidential before the migration and setting all trusted
    # applications are not confidential would introduce security
    # issues.
  end
end