Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20200408132152_remove_namespaces_trial_ends_on.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cfe0daaf50f79b324d237af6211c2cdd9b805819 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

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

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    remove_concurrent_index_by_name :namespaces, 'index_namespaces_on_trial_ends_on'

    with_lock_retries do
      remove_column :namespaces, :trial_ends_on
    end
  end

  def down
    unless column_exists?(:namespaces, :trial_ends_on)
      with_lock_retries do
        add_column :namespaces, :trial_ends_on, :datetime_with_timezone
      end
    end

    add_concurrent_index :namespaces, :trial_ends_on, using: 'btree', where: 'trial_ends_on IS NOT NULL'
  end
end