diff --git a/Sources/FluentPostgresDriver/PostgresConverterDelegate.swift b/Sources/FluentPostgresDriver/PostgresConverterDelegate.swift index 406e6cc..b61c847 100644 --- a/Sources/FluentPostgresDriver/PostgresConverterDelegate.swift +++ b/Sources/FluentPostgresDriver/PostgresConverterDelegate.swift @@ -5,6 +5,8 @@ struct PostgresConverterDelegate: SQLConverterDelegate { switch dataType { case .uuid: return SQLRaw("UUID") + case .bool: + return SQLRaw("BOOL") default: return nil } diff --git a/Tests/FluentPostgresDriverTests/FluentPostgresDriverTests.swift b/Tests/FluentPostgresDriverTests/FluentPostgresDriverTests.swift index 1eea8bb..22ec12a 100644 --- a/Tests/FluentPostgresDriverTests/FluentPostgresDriverTests.swift +++ b/Tests/FluentPostgresDriverTests/FluentPostgresDriverTests.swift @@ -112,6 +112,24 @@ final class FluentPostgresDriverTests: XCTestCase { try self.benchmarker.testUUIDModel() } + func testSaveModelWithBool() throws { + struct Organization: Model { + static let shared = Organization() + static let entity = "organizations" + let id = Field("id") + let disabled = Field("disabled") + } + + try Organization.autoMigration().prepare(on: self.connectionPool).wait() + defer { + try! Organization.autoMigration().revert(on: self.connectionPool).wait() + } + + let new = Organization.row() + new.disabled = false + try new.save(on: self.connectionPool).wait() + } + var benchmarker: FluentBenchmarker! var connectionPool: ConnectionPool! var eventLoopGroup: EventLoopGroup! diff --git a/Tests/FluentPostgresDriverTests/XCTestManifests.swift b/Tests/FluentPostgresDriverTests/XCTestManifests.swift index 19b7705..dc6ef62 100644 --- a/Tests/FluentPostgresDriverTests/XCTestManifests.swift +++ b/Tests/FluentPostgresDriverTests/XCTestManifests.swift @@ -27,11 +27,13 @@ extension FluentPostgresDriverTests { ("testNestedModel", testNestedModel), ("testNullifyField", testNullifyField), ("testRead", testRead), + ("testSaveModelWithBool", testSaveModelWithBool), ("testSoftDelete", testSoftDelete), ("testSort", testSort), ("testTimestampable", testTimestampable), ("testUniqueFields", testUniqueFields), ("testUpdate", testUpdate), + ("testUUIDModel", testUUIDModel), ] }