debian-mirror-gitlab/db/post_migrate/20200212052620_readd_template_column_to_services.rb

26 lines
851 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
class ReaddTemplateColumnToServices < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
2020-04-22 19:07:51 +05:30
# rubocop:disable Migration/UpdateLargeTable
2020-03-13 15:44:24 +05:30
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`.
2020-05-24 23:13:21 +05:30
add_column_with_default :services, :template, :boolean, default: false, allow_null: true # rubocop:disable Migration/AddColumnWithDefault
2020-03-13 15:44:24 +05:30
end
2020-04-22 19:07:51 +05:30
# rubocop:enable Migration/UpdateLargeTable
2020-03-13 15:44:24 +05:30
def down
# NOP since the column is expected to exist
end
end