Skip to content

Commit 42c5478

Browse files
committed
feat(matrix): fix matrix data types for MySQL
1 parent cf5219c commit 42c5478

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/pact_broker/matrix/latest_row.rb

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22

33
module PactBroker
44
module Matrix
5-
65
# Latest pact revision for each consumer version => latest verification
7-
86
class LatestRow < Row
97
set_dataset(:latest_matrix)
8+
9+
# For some reason, with MySQL, the success column value
10+
# comes back as an integer rather than a boolean
11+
# for the latest_matrix view (but not the matrix view!)
12+
# Maybe something to do with the union?
13+
# Haven't investigated as this is an easy enough fix.
14+
def success
15+
value = super
16+
value.nil? ? nil : value == true || value == 1
17+
end
18+
19+
def values
20+
super.merge(success: success)
21+
end
1022
end
1123
end
1224
end

0 commit comments

Comments
 (0)