Skip to content

Commit 61bf446

Browse files
authored
alpha 3 (#121)
1 parent 84c69a9 commit 61bf446

File tree

1 file changed

+36
-12
lines changed

1 file changed

+36
-12
lines changed

Tests/FluentPostgresDriverTests/FluentPostgresDriverTests.swift

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -112,23 +112,41 @@ final class FluentPostgresDriverTests: XCTestCase {
112112
try self.benchmarker.testUUIDModel()
113113
}
114114

115+
func testNewModelDecode() throws {
116+
try self.benchmarker.testNewModelDecode()
117+
}
118+
119+
func testSiblingsAttach() throws {
120+
try self.benchmarker.testSiblingsAttach()
121+
}
122+
123+
func testSiblingsEagerLoad() throws {
124+
try self.benchmarker.testSiblingsEagerLoad()
125+
}
126+
115127
func testBlob() throws {
116128
final class Foo: Model {
117-
@Field var id: Int?
118-
@Field var data: [UInt8]
129+
static let schema = "foos"
130+
131+
@ID(key: "id")
132+
var id: Int?
133+
134+
@Field(key: "data")
135+
var data: [UInt8]
136+
119137
init() { }
120138
}
121139

122140
struct CreateFoo: Migration {
123141
func prepare(on database: Database) -> EventLoopFuture<Void> {
124-
return Foo.schema(on: database)
125-
.field(\.$id, .int, .identifier(auto: true))
126-
.field(\.$data, .data, .required)
142+
return database.schema("foos")
143+
.field("id", .int, .identifier(auto: true))
144+
.field("data", .data, .required)
127145
.create()
128146
}
129147

130148
func revert(on database: Database) -> EventLoopFuture<Void> {
131-
return Foo.schema(on: database).delete()
149+
return database.schema("foos").delete()
132150
}
133151
}
134152

@@ -138,21 +156,27 @@ final class FluentPostgresDriverTests: XCTestCase {
138156

139157
func testSaveModelWithBool() throws {
140158
final class Organization: Model {
141-
@Field var id: Int?
142-
@Field var disabled: Bool
159+
static let schema = "orgs"
160+
161+
@ID(key: "id")
162+
var id: Int?
163+
164+
@Field(key: "disabled")
165+
var disabled: Bool
166+
143167
init() { }
144168
}
145169

146170
struct CreateOrganization: Migration {
147171
func prepare(on database: Database) -> EventLoopFuture<Void> {
148-
return Organization.schema(on: database)
149-
.field(\.$id, .int, .identifier(auto: true))
150-
.field(\.$disabled, .bool, .required)
172+
return database.schema("orgs")
173+
.field("id", .int, .identifier(auto: true))
174+
.field("disabled", .bool, .required)
151175
.create()
152176
}
153177

154178
func revert(on database: Database) -> EventLoopFuture<Void> {
155-
return Organization.schema(on: database).delete()
179+
return database.schema("orgs").delete()
156180
}
157181
}
158182

0 commit comments

Comments
 (0)