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

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

  def up
    execute(
      <<-SQL
      UPDATE
        application_settings
      SET
        grafana_url = default
      WHERE
        position('javascript:' IN btrim(application_settings.grafana_url)) = 1
      SQL
    )
  end

  def down
    # no-op
  end
end