diff options
-rw-r--r-- | src/main/scala/NamespacedCodegen.scala | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/scala/NamespacedCodegen.scala b/src/main/scala/NamespacedCodegen.scala index d73fc3e..b435830 100644 --- a/src/main/scala/NamespacedCodegen.scala +++ b/src/main/scala/NamespacedCodegen.scala @@ -217,13 +217,17 @@ object SchemaParser { def createModel(jdbcProfile: JdbcProfile, mappedSchemas: Map[String, List[String]]): DBIO[Model] = { val allTables: DBIO[Vector[MTable]] = MTable.getTables - val filteredTables: DBIO[Vector[MTable]] = allTables.map( - (tables: Vector[MTable]) => tables.filter(table => - table.name.schema.flatMap(mappedSchemas.get).exists(ts => - ts.isEmpty || ts.contains(table.name.name)) + if (mappedSchemas.isEmpty) { + jdbcProfile.createModel(Some(allTables)) + } else { + val filteredTables: DBIO[Vector[MTable]] = allTables.map( + (tables: Vector[MTable]) => tables.filter(table => + table.name.schema.flatMap(mappedSchemas.get).exists(ts => + ts.isEmpty || ts.contains(table.name.name)) + ) ) - ) - jdbcProfile.createModel(Some(filteredTables)) + jdbcProfile.createModel(Some(filteredTables)) + } } } |