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

class RemoveOldIndexPagesDomainsNeedAutoSslRenewal < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal'

  disable_ddl_transaction!

  def up
    remove_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after],
                            where: "auto_ssl_enabled = true", name: INDEX_NAME)
  end

  def down
    add_concurrent_index(:pages_domains, [:certificate_source, :certificate_valid_not_after],
                         where: "auto_ssl_enabled = true", name: INDEX_NAME)
  end
end