@@ -113,22 +113,22 @@ final class FluentPostgresDriverTests: XCTestCase {
113113 }
114114
115115 func testBlob( ) throws {
116- struct Foo : Model {
117- static let shared = Foo ( )
118- var id = Field < Int ? > ( " id " )
119- var data = Field < [ UInt8 ] > ( " data " )
116+ final class Foo : Model {
117+ @ Field var id : Int ?
118+ @ Field var data : [ UInt8 ]
119+ init ( ) { }
120120 }
121121
122122 struct CreateFoo : Migration {
123123 func prepare( on database: Database ) -> EventLoopFuture < Void > {
124- return database . schema ( Foo . self )
125- . field ( \. id, . int, . identifier( auto: true ) )
126- . field ( \. data, . data, . required)
124+ return Foo . schema ( on : database )
125+ . field ( \. $ id, . int, . identifier( auto: true ) )
126+ . field ( \. $ data, . data, . required)
127127 . create ( )
128128 }
129129
130130 func revert( on database: Database ) -> EventLoopFuture < Void > {
131- return database . schema ( Foo . self ) . delete ( )
131+ return Foo . schema ( on : database ) . delete ( )
132132 }
133133 }
134134
@@ -137,19 +137,31 @@ final class FluentPostgresDriverTests: XCTestCase {
137137 }
138138
139139 func testSaveModelWithBool( ) throws {
140- struct Organization : Model {
141- static let shared = Organization ( )
142- static let entity = " organizations "
143- let id = Field < Int ? > ( " id " )
144- let disabled = Field < Bool > ( " disabled " )
140+ final class Organization : Model {
141+ @Field var id : Int ?
142+ @Field var disabled : Bool
143+ init ( ) { }
145144 }
146145
147- try Organization . autoMigration ( ) . prepare ( on: self . connectionPool) . wait ( )
146+ struct CreateOrganization : Migration {
147+ 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)
151+ . create ( )
152+ }
153+
154+ func revert( on database: Database ) -> EventLoopFuture < Void > {
155+ return Organization . schema ( on: database) . delete ( )
156+ }
157+ }
158+
159+ try CreateOrganization ( ) . prepare ( on: self . connectionPool) . wait ( )
148160 defer {
149- try ! Organization . autoMigration ( ) . revert ( on: self . connectionPool) . wait ( )
161+ try ! CreateOrganization ( ) . revert ( on: self . connectionPool) . wait ( )
150162 }
151163
152- let new = Organization . row ( )
164+ let new = Organization ( )
153165 new. disabled = false
154166 try new. save ( on: self . connectionPool) . wait ( )
155167 }
0 commit comments