Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Jul 26, 2018
2 parents 31473c2 + 9be6598 commit 0744cd4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Expand Up @@ -105,7 +105,7 @@ extension PostgreSQLDatabase: QuerySupporting {
{
switch event {
case .willCreate:
if M.ID.self == UUID.self {
if M.ID.self == UUID.self, model.fluentID == nil {
var model = model
model.fluentID = UUID() as? M.ID
return conn.future(model)
Expand Down
9 changes: 8 additions & 1 deletion Sources/FluentPostgreSQL/PostgreSQLEnum.swift
Expand Up @@ -14,7 +14,14 @@ extension PostgreSQLRawEnum where Self.RawValue: PostgreSQLDataTypeStaticReprese
extension PostgreSQLEnum {
/// See `PostgreSQLEnum`.
public static var postgreSQLEnumTypeName: String {
return "\(self)".uppercased()
return String(reflecting: self)
.components(separatedBy: ".")
.dropFirst()
.joined(separator: "_")
// TODO: Determine if this should actually be uppercased.
// The PostgreSQL documentation for the ENUM type always
// shows this name being lowercased.
.uppercased()
}

/// See `PostgreSQLDataTypeStaticRepresentable`.
Expand Down

0 comments on commit 0744cd4

Please sign in to comment.