BigW Consortium Gitlab

20160827011312_ensure_lock_version_has_no_default.rb 436 Bytes
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