Skip to content

Commit 0744cd4

Browse files
authored
Merge branch 'master' into release
2 parents 31473c2 + 9be6598 commit 0744cd4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Sources/FluentPostgreSQL/PostgreSQLDatabase+QuerySupporting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ extension PostgreSQLDatabase: QuerySupporting {
105105
{
106106
switch event {
107107
case .willCreate:
108-
if M.ID.self == UUID.self {
108+
if M.ID.self == UUID.self, model.fluentID == nil {
109109
var model = model
110110
model.fluentID = UUID() as? M.ID
111111
return conn.future(model)

Sources/FluentPostgreSQL/PostgreSQLEnum.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ extension PostgreSQLRawEnum where Self.RawValue: PostgreSQLDataTypeStaticReprese
1414
extension PostgreSQLEnum {
1515
/// See `PostgreSQLEnum`.
1616
public static var postgreSQLEnumTypeName: String {
17-
return "\(self)".uppercased()
17+
return String(reflecting: self)
18+
.components(separatedBy: ".")
19+
.dropFirst()
20+
.joined(separator: "_")
21+
// TODO: Determine if this should actually be uppercased.
22+
// The PostgreSQL documentation for the ENUM type always
23+
// shows this name being lowercased.
24+
.uppercased()
1825
}
1926

2027
/// See `PostgreSQLDataTypeStaticRepresentable`.

0 commit comments

Comments
 (0)