Commit 68cb1c26 authored by Mark Chao's avatar Mark Chao Committed by Yorick Peterse

Revert rename allow collaboration column

parent e1f9f3c6
...@@ -1125,8 +1125,11 @@ class MergeRequest < ActiveRecord::Base ...@@ -1125,8 +1125,11 @@ class MergeRequest < ActiveRecord::Base
project.merge_requests.merged.where(author_id: author_id).empty? project.merge_requests.merged.where(author_id: author_id).empty?
end end
# TODO: remove once production database rename completes
alias_attribute :allow_collaboration, :allow_maintainer_to_push
def allow_collaboration def allow_collaboration
collaborative_push_possible? && super collaborative_push_possible? && allow_maintainer_to_push
end end
alias_method :allow_collaboration?, :allow_collaboration alias_method :allow_collaboration?, :allow_collaboration
......
...@@ -6,10 +6,12 @@ class RenameMergeRequestsAllowMaintainerToPush < ActiveRecord::Migration ...@@ -6,10 +6,12 @@ class RenameMergeRequestsAllowMaintainerToPush < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def up def up
rename_column_concurrently :merge_requests, :allow_maintainer_to_push, :allow_collaboration # NOOP
end end
def down def down
cleanup_concurrent_column_rename :merge_requests, :allow_collaboration, :allow_maintainer_to_push if column_exists?(:merge_requests, :allow_collaboration)
cleanup_concurrent_column_rename :merge_requests, :allow_collaboration, :allow_maintainer_to_push
end
end end
end end
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class RenameMergeRequestsAllowCollaboration < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def up
if column_exists?(:merge_requests, :allow_collaboration)
rename_column_concurrently :merge_requests, :allow_collaboration, :allow_maintainer_to_push
end
end
def down
# NOOP
end
end
...@@ -6,10 +6,12 @@ class CleanupMergeRequestsAllowMaintainerToPushRename < ActiveRecord::Migration ...@@ -6,10 +6,12 @@ class CleanupMergeRequestsAllowMaintainerToPushRename < ActiveRecord::Migration
disable_ddl_transaction! disable_ddl_transaction!
def up def up
cleanup_concurrent_column_rename :merge_requests, :allow_maintainer_to_push, :allow_collaboration # NOOP
end end
def down def down
rename_column_concurrently :merge_requests, :allow_collaboration, :allow_maintainer_to_push if column_exists?(:merge_requests, :allow_collaboration)
rename_column_concurrently :merge_requests, :allow_collaboration, :allow_maintainer_to_push
end
end end
end end
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class CleanupMergeRequestsAllowCollaborationRename < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
if column_exists?(:merge_requests, :allow_collaboration)
cleanup_concurrent_column_rename :merge_requests, :allow_collaboration, :allow_maintainer_to_push
end
end
def down
# NOOP
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180603190921) do ActiveRecord::Schema.define(version: 20180608201435) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -1231,8 +1231,8 @@ ActiveRecord::Schema.define(version: 20180603190921) do ...@@ -1231,8 +1231,8 @@ ActiveRecord::Schema.define(version: 20180603190921) do
t.boolean "discussion_locked" t.boolean "discussion_locked"
t.integer "latest_merge_request_diff_id" t.integer "latest_merge_request_diff_id"
t.string "rebase_commit_sha" t.string "rebase_commit_sha"
t.boolean "allow_collaboration"
t.boolean "squash", default: false, null: false t.boolean "squash", default: false, null: false
t.boolean "allow_maintainer_to_push"
end end
add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree
......
...@@ -170,7 +170,7 @@ MergeRequest: ...@@ -170,7 +170,7 @@ MergeRequest:
- last_edited_by_id - last_edited_by_id
- head_pipeline_id - head_pipeline_id
- discussion_locked - discussion_locked
- allow_collaboration - allow_maintainer_to_push
MergeRequestDiff: MergeRequestDiff:
- id - id
- state - state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment