2017-12-11 11:34:51 -05:00
|
|
|
# rubocop:disable Migration/RemoveColumn
|
2016-08-01 18:31:21 -04:00
|
|
|
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
|
|
|
|
# for more information on how to write migrations for GitLab.
|
|
|
|
|
2017-11-17 08:38:14 -05:00
|
|
|
# rubocop:disable Migration/UpdateLargeTable
|
2018-11-13 02:27:31 -05:00
|
|
|
class RemoveFeaturesEnabledFromProjects < ActiveRecord::Migration[4.2]
|
2016-08-01 18:31:21 -04:00
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
disable_ddl_transaction!
|
|
|
|
|
|
|
|
# Set this constant to true if this migration requires downtime.
|
|
|
|
DOWNTIME = true
|
|
|
|
DOWNTIME_REASON = "Removing fields from database requires downtine."
|
|
|
|
|
|
|
|
def up
|
|
|
|
remove_column :projects, :issues_enabled
|
|
|
|
remove_column :projects, :merge_requests_enabled
|
|
|
|
remove_column :projects, :builds_enabled
|
|
|
|
remove_column :projects, :wiki_enabled
|
|
|
|
remove_column :projects, :snippets_enabled
|
|
|
|
end
|
|
|
|
|
|
|
|
# Ugly SQL but the only way i found to make it work on both Postgres and Mysql
|
|
|
|
# It will be slow but it is ok since it is a revert method
|
|
|
|
def down
|
|
|
|
add_column_with_default(:projects, :issues_enabled, :boolean, default: true, allow_null: false)
|
|
|
|
add_column_with_default(:projects, :merge_requests_enabled, :boolean, default: true, allow_null: false)
|
|
|
|
add_column_with_default(:projects, :builds_enabled, :boolean, default: true, allow_null: false)
|
|
|
|
add_column_with_default(:projects, :wiki_enabled, :boolean, default: true, allow_null: false)
|
|
|
|
add_column_with_default(:projects, :snippets_enabled, :boolean, default: true, allow_null: false)
|
|
|
|
end
|
|
|
|
end
|