Skip to content

Fixed migration ConvertClosedToStateInMergeRequest to work with postgresql

Created by: anthonymoralez

When I ran rake db:migrate with a postgresql database it failed like so:

==  ConvertClosedToStateInMergeRequest: migrating =============================
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  operator does not exist: boolean = integer
LINE 1: ...erge_requests" SET state = 'merged' WHERE (closed = 1 AND me...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
: UPDATE "merge_requests" SET state = 'merged' WHERE (closed = 1 AND merged = 1)
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/connection_adapters/postgr
esql_adapter.rb:1153:in `async_exec'

I tested my fix against a mysql database. It worked there as well.

Merge request reports

Loading