aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Gushue <tim@drivergrp.com>2016-11-14 17:06:15 -0800
committerTim Gushue <tim@drivergrp.com>2016-11-14 17:06:15 -0800
commit929aa3f88643f4e4746e6016f9ad962b727bce2c (patch)
tree85c00efac6b0e054c69865c6423949c3ca88b6e9
parent4a950f529691d60ecb58ae8a930af3858ed8f5e2 (diff)
downloadslick-codegen-plugin-929aa3f88643f4e4746e6016f9ad962b727bce2c.tar.gz
slick-codegen-plugin-929aa3f88643f4e4746e6016f9ad962b727bce2c.tar.bz2
slick-codegen-plugin-929aa3f88643f4e4746e6016f9ad962b727bce2c.zip
TM-251 bug(no default table import) createModel will gen whole DB if codegenSchemaWhitelist is empty
-rw-r--r--src/main/scala/NamespacedCodegen.scala16
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))
+ }
}
}