summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200120083607_remove_storage_version_column_from_snippets.rb
blob: e94dc75e65c0ef3b3c60b036c2f15d4aaefff875 (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
28
29
30
# frozen_string_literal: true

# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class RemoveStorageVersionColumnFromSnippets < ActiveRecord::Migration[5.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  disable_ddl_transaction!

  def up
    return unless column_exists?(:snippets, :storage_version)

    remove_column :snippets, :storage_version
  end

  def down
    return if column_exists?(:snippets, :storage_version)

    add_column_with_default(
      :snippets,
      :storage_version,
      :integer,
      default: 2,
      allow_null: false
    )
  end
end