Skip to content

Commit 9be6598

Browse files
authored
Merge pull request #83 from clayellis/master
Change default postgreSQLEnumTypeName to include full type path
2 parents eea3a44 + bae54da commit 9be6598

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Sources/FluentPostgreSQL/PostgreSQLEnum.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ public protocol PostgreSQLEnum: PostgreSQLExpressionRepresentable, CaseIterable,
55
extension PostgreSQLEnum {
66
/// See `PostgreSQLEnum`.
77
public static var postgreSQLEnumTypeName: String {
8-
return "\(self)".uppercased()
8+
return String(reflecting: self)
9+
.components(separatedBy: ".")
10+
.dropFirst()
11+
.joined(separator: "_")
12+
// TODO: Determine if this should actually be uppercased.
13+
// The PostgreSQL documentation for the ENUM type always
14+
// shows this name being lowercased.
15+
.uppercased()
916
}
1017

1118
/// See `PostgreSQLDataTypeStaticRepresentable`.

0 commit comments

Comments
 (0)