@@ -459,6 +459,38 @@ class FluentPostgreSQLTests: XCTestCase {
459459 defer { try ? C . revert ( on: conn) . wait ( ) }
460460 }
461461
462+ // https://github.com/vapor/fluent-postgresql/issues/85
463+ func testGH85( ) throws {
464+ /// The Exact enum from my project
465+ enum Availability : UInt8 , PostgreSQLRawEnum {
466+ static var allCases : [ Availability ] = [ . everyday, . sunday, . monday, . tuesday, . wednesday, . thursday, . friday, . saturday]
467+
468+ case everyday
469+ case sunday
470+ case monday
471+ case tuesday
472+ case wednesday
473+ case thursday
474+ case friday
475+ case saturday
476+ }
477+
478+ struct Foo : PostgreSQLModel , Migration {
479+ var id : Int ?
480+ var availability : Availability
481+ }
482+
483+ let conn = try benchmarker. pool. requestConnection ( ) . wait ( )
484+ conn. logger = DatabaseLogger ( database: . psql, handler: PrintLogHandler ( ) )
485+ defer { benchmarker. pool. releaseConnection ( conn) }
486+
487+ try Foo . prepare ( on: conn) . wait ( )
488+ defer { try ? Foo . revert ( on: conn) . wait ( ) }
489+
490+ let a = Foo ( id: nil , availability: . everyday)
491+ _ = try a. save ( on: conn) . wait ( )
492+ }
493+
462494 static let allTests = [
463495 ( " testBenchmark " , testBenchmark) ,
464496 ( " testNestedStruct " , testNestedStruct) ,
@@ -475,6 +507,7 @@ class FluentPostgreSQLTests: XCTestCase {
475507 ( " testCustomFilter " , testCustomFilter) ,
476508 ( " testCreateOrUpdate " , testCreateOrUpdate) ,
477509 ( " testEnumArray " , testEnumArray) ,
510+ ( " testGH85 " , testGH85) ,
478511 ]
479512}
480513
0 commit comments