summaryrefslogtreecommitdiff
path: root/db/migrate/20200406100909_add_needs_ssl_renewal_valid_not_after_pages_domains_index.rb
blob: 3c5db9ec0828105bd2e818e65202fa5db41a573a (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 AddNeedsSslRenewalValidNotAfterPagesDomainsIndex < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  INDEX_NAME = 'index_pages_domains_need_auto_ssl_renewal_valid_not_after'
  INDEX_SCOPE = "auto_ssl_enabled = true AND auto_ssl_failed = false"

  disable_ddl_transaction!

  def up
    add_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME)
  end

  def down
    remove_concurrent_index(:pages_domains, :certificate_valid_not_after, where: INDEX_SCOPE, name: INDEX_NAME)
  end
end