@@ -59,23 +59,19 @@ class FluentPostgreSQLTests: XCTestCase {
59
59
}
60
60
61
61
func testNestedStruct( ) throws {
62
- /// Swift runtime does not yet support dynamically querying conditional conformance ('Swift.Array<Swift.String>': 'CodableKit.AnyKeyStringDecodable')
63
- return ;
64
62
let conn = try database. makeConnection ( on: eventLoop) . await ( on: eventLoop)
63
+ try ? User . revert ( on: conn) . await ( on: eventLoop)
65
64
try User . prepare ( on: conn) . await ( on: eventLoop)
66
65
let user = User ( id: nil , name: " Tanner " , pet: Pet ( name: " Zizek " ) )
67
66
user. favoriteColors = [ " pink " , " blue " ]
68
- user. dict [ " hello " ] = " world "
69
67
_ = try user. save ( on: conn) . await ( on: eventLoop)
70
68
if let fetched = try User . query ( on: conn) . first ( ) . await ( on: eventLoop) {
71
69
XCTAssertEqual ( user. id, fetched. id)
72
70
XCTAssertNil ( user. age)
73
71
XCTAssertEqual ( fetched. favoriteColors, [ " pink " , " blue " ] )
74
- XCTAssertEqual ( fetched. dict [ " hello " ] , " world " )
75
72
} else {
76
73
XCTFail ( )
77
74
}
78
-
79
75
try User . revert ( on: conn) . await ( on: eventLoop)
80
76
conn. close ( )
81
77
}
@@ -121,7 +117,7 @@ class FluentPostgreSQLTests: XCTestCase {
121
117
]
122
118
}
123
119
124
- struct Pet : PostgreSQLJSONType {
120
+ struct Pet : PostgreSQLJSONType , Codable {
125
121
var name : String
126
122
}
127
123
@@ -132,11 +128,9 @@ final class User: PostgreSQLModel, Migration {
132
128
var age : Int ?
133
129
var favoriteColors : [ String ]
134
130
var pet : Pet
135
- var dict : [ String : String ]
136
131
137
132
init ( id: Int ? = nil , name: String , pet: Pet ) {
138
133
self . favoriteColors = [ ]
139
- self . dict = [ : ]
140
134
self . id = id
141
135
self . name = name
142
136
self . pet = pet
0 commit comments