2020-02-04 15:08:40 +00:00
|
|
|
# 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 DefaultLockVersionToZeroForMergeRequests < ActiveRecord::Migration[6.0]
|
|
|
|
include Gitlab::Database::MigrationHelpers
|
|
|
|
|
|
|
|
# Set this constant to true if this migration requires downtime.
|
|
|
|
DOWNTIME = false
|
|
|
|
|
2020-03-12 12:09:17 +00:00
|
|
|
def up
|
2020-02-04 15:08:40 +00:00
|
|
|
with_lock_retries do
|
|
|
|
change_column_default :merge_requests, :lock_version, from: nil, to: 0
|
|
|
|
end
|
|
|
|
end
|
2020-03-12 12:09:17 +00:00
|
|
|
|
|
|
|
def down
|
|
|
|
with_lock_retries do
|
|
|
|
change_column_default :merge_requests, :lock_version, from: 0, to: nil
|
|
|
|
end
|
|
|
|
end
|
2020-02-04 15:08:40 +00:00
|
|
|
end
|