Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ let package = Package(
],
dependencies: [
// 🌎 Utility package containing tools for byte manipulation, Codable, OS APIs, and debugging.
.package(url: "https://github.com/vapor/core.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/core.git", .branch("fluent-gm")),

// Swift ORM framework (queries, models, and relations) for building NoSQL and SQL database integrations.
.package(url: "https://github.com/vapor/fluent.git", from: "3.0.0-rc"),
.package(url: "https://github.com/vapor/fluent.git", .branch("master")),

// 🐘 Non-blocking, event-driven Swift client for PostgreSQL.
.package(url: "https://github.com/vapor/postgresql.git", from: "1.0.0-rc.2"),
.package(url: "https://github.com/vapor/postgresql.git", .branch("master")),
],
targets: [
.target(name: "FluentPostgreSQL", dependencies: ["Async", "Fluent", "FluentSQL", "PostgreSQL"]),
.target(name: "FluentPostgreSQL", dependencies: ["Async", "Fluent", "PostgreSQL"]),
.testTarget(name: "FluentPostgreSQLTests", dependencies: ["FluentBenchmark", "FluentPostgreSQL"]),
]
)
27 changes: 27 additions & 0 deletions Sources/FluentPostgreSQL/Deprecated.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@available(*, deprecated, renamed: "PostgreSQLDataConvertible")
public typealias PostgreSQLColumnStaticRepresentable = PostgreSQLDataConvertible

/// - warning: Deprecated.
@available(*, deprecated, renamed: "PostgreSQLType")
public protocol PostgreSQLJSONType: PostgreSQLType { }

/// - warning: Deprecated.
@available(*, deprecated, renamed: "PostgreSQLType")
public protocol PostgreSQLArrayType: PostgreSQLType { }

// - warning: Deprecated.
@available(*, deprecated, message: "Use custom migration instead.")
public protocol PostgreSQLEnumType { }

// - warning: Deprecated.
@available(*, deprecated, message: "Use custom migration instead.")
public protocol PostgreSQLType { }


extension QueryBuilder where Database == PostgreSQLDatabase {
/// - warning: Deprecated.
@available(*, deprecated, renamed: "groupBy(_:)")
public func group<T>(by field: KeyPath<Result, T>) -> Self {
return groupBy(field)
}
}
1 change: 0 additions & 1 deletion Sources/FluentPostgreSQL/Exports.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
@_exported import Fluent
@_exported import FluentSQL
@_exported import PostgreSQL
20 changes: 9 additions & 11 deletions Sources/FluentPostgreSQL/FluentPostgreSQLProvider.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import Async
import Service

/// Adds Fluent PostgreSQL's services to your project.
public final class FluentPostgreSQLProvider: Provider {
/// See `Provider.repositoryName`
public static let repositoryName = "fluent-postgresql"

/// Creates a new `FluentPostgreSQLProvider`
///
/// - enableIdentityColumns: If true, `GENERATED BY DEFAULT AS IDENTITY` will be used.
Expand All @@ -16,17 +10,21 @@ public final class FluentPostgreSQLProvider: Provider {
}
}

/// See `Provider.register(_:)`
/// See `Provider`.
public func register(_ services: inout Services) throws {
try services.register(FluentProvider())
try services.register(PostgreSQLProvider())
}

/// See `Provider.boot(_:)`
/// See `Provider`.
public func willBoot(_ worker: Container) throws -> Future<Void> {
struct Setting: Codable {
var version: String
}

return worker.withPooledConnection(to: .psql) { conn in
return conn.simpleQuery("SELECT current_setting('server_version') as version").map(to: Void.self) { rows in
_serverVersion = try rows[0].firstValue(forColumn: "version")!.decode(String.self)
return conn.simpleQuery("SELECT current_setting('server_version') as version", decoding: Setting.self).map { rows in
_serverVersion = rows[0].version
if let versionString = _serverVersion {
let pointIndex = versionString.index(of: ".") ?? versionString.endIndex
let majorVersion = versionString[..<pointIndex]
Expand All @@ -38,7 +36,7 @@ public final class FluentPostgreSQLProvider: Provider {
}
}

/// See `Provider.boot(_:)`
/// See `Provider`.
public func didBoot(_ worker: Container) throws -> Future<Void> {
return .done(on: worker)
}
Expand Down
27 changes: 0 additions & 27 deletions Sources/FluentPostgreSQL/PostgreSQLColumn.swift

This file was deleted.

Loading