Commit d836a359 authored by Stan Hu's avatar Stan Hu Committed by Ruben Davila

Merge branch 'lock_fix' into 'master'

Remove default value for lock_version

From the very beginning we added `lock_version` column with default value, then we reverted that MR. A bit later we added that migration again but column's default value has been removed from migration. So if you installed GitLab form master it's possible that you have default value, which caused  the bug.

We don't need to change a CHANGELOG here I think.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21527 and https://dev.gitlab.org/gitlab/organization/issues/971

See merge request !6111
Conflicts:
	db/schema.rb
parent 636a1c7c
class EnsureLockVersionHasNoDefault < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
change_column_default :issues, :lock_version, nil
change_column_default :merge_requests, :lock_version, nil
execute('UPDATE issues SET lock_version = 1 WHERE lock_version = 0')
execute('UPDATE merge_requests SET lock_version = 1 WHERE lock_version = 0')
end
def down
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: 20160819221833) do ActiveRecord::Schema.define(version: 20160827011312) 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"
...@@ -1154,4 +1154,4 @@ ActiveRecord::Schema.define(version: 20160819221833) do ...@@ -1154,4 +1154,4 @@ ActiveRecord::Schema.define(version: 20160819221833) do
add_foreign_key "protected_branch_merge_access_levels", "protected_branches" add_foreign_key "protected_branch_merge_access_levels", "protected_branches"
add_foreign_key "protected_branch_push_access_levels", "protected_branches" add_foreign_key "protected_branch_push_access_levels", "protected_branches"
add_foreign_key "u2f_registrations", "users" add_foreign_key "u2f_registrations", "users"
end end
\ No newline at end of file
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