Skip to content

Commit

Permalink
fix enum column names in sql files
Browse files Browse the repository at this point in the history
  • Loading branch information
oyvindberg committed Jun 19, 2023
1 parent 734c041 commit b36afc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion typo/src/scala/typo/internal/TypeMapperDb.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ case class TypeMapperDb(enums: Map[String, db.StringEnum], domains: Map[String,
case str if str.startsWith("_") => dbTypeFrom(udtName.drop(1), characterMaximumLength).map(tpe => db.Type.Array(tpe))
case typeName =>
enums
.get(typeName)
.get(typeName.replaceAll("\"", ""))
.map(`enum` => db.Type.EnumRef(`enum`.name))
.orElse(domains.get(typeName).map(domain => db.Type.DomainRef(domain.name)))
}
Expand Down
2 changes: 1 addition & 1 deletion typo/src/scala/typo/internal/metadb/load.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ object load {
val primaryKeys = PrimaryKeys(input.tableConstraints, input.keyColumnUsage)
val uniqueKeys = UniqueKeys(input.tableConstraints, input.keyColumnUsage)
val enums = Enums(input.pgEnums)
val enumsByName = enums.map(e => (e.name.name, e)).toMap
val enumsByName = enums.flatMap(e => List((e.name.name, e), (e.name.value, e))).toMap
val domains = input.domains.map { d =>
val tpe = TypeMapperDb(enumsByName, Map.empty)
.dbTypeFrom(
Expand Down

0 comments on commit b36afc9

Please sign in to comment.