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

class AddGroupCreationLevelToNamespaces < ActiveRecord::Migration[5.1]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  disable_ddl_transaction!

  def up
    unless column_exists?(:namespaces, :subgroup_creation_level)
      add_column_with_default(:namespaces,
                              :subgroup_creation_level,
                              :integer,
                              default: 0)
    end
  end

  def down
    if column_exists?(:namespaces, :subgroup_creation_level)
      remove_column(:namespaces, :subgroup_creation_level)
    end
  end
end