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

20200212052620_readd_template_column_to_services.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c636cb0a07bb4eb095741f1c60a82c14d1a3c092 (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
# frozen_string_literal: true

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

  DOWNTIME = false

  disable_ddl_transaction!

  # rubocop:disable Migration/UpdateLargeTable
  def up
    return if column_exists? :services, :template

    # The migration to drop the template column never actually shipped
    # to production, so we should be okay to re-add it without worrying
    # about doing a data migration.  If we needed to restore the value
    # of `template`, we would look for entries with `project_id IS NULL`.
    add_column_with_default :services, :template, :boolean, default: false, allow_null: true # rubocop:disable Migration/AddColumnWithDefault
  end
  # rubocop:enable Migration/UpdateLargeTable

  def down
    # NOP since the column is expected to exist
  end
end