diff options
author | Stewart Stewart <stewinsalot@gmail.com> | 2017-02-15 12:39:13 -0800 |
---|---|---|
committer | Stewart Stewart <stewinsalot@gmail.com> | 2017-02-15 12:39:26 -0800 |
commit | 262d532e30132c2623e63cec6a6386e1bcb35454 (patch) | |
tree | a76641c3a74d415a7df941f4db5b677095f38175 /src/main/scala | |
parent | 358c81c1b19168f52e3993410cd09eed423d9def (diff) | |
download | slick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.tar.gz slick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.tar.bz2 slick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.zip |
override tables
Diffstat (limited to 'src/main/scala')
-rw-r--r-- | src/main/scala/NamespacedCodegen.scala | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main/scala/NamespacedCodegen.scala b/src/main/scala/NamespacedCodegen.scala index c0d0de2..dbcbb98 100644 --- a/src/main/scala/NamespacedCodegen.scala +++ b/src/main/scala/NamespacedCodegen.scala @@ -131,13 +131,13 @@ class Generator(pkg: String, |} |""".stripMargin - override def code: String = { - - val schemaTables = - tables.filter(_.model.name.schema.getOrElse("`public`") == schemaName) - // TODO override `tables` instead of `code` + override def tables = { + super.tables + .filter(_.model.name.schema.getOrElse("`public`") == schemaName) + } - val tableCode = schemaTables + override def code: String = { + val tableCode = tables .sortBy(_.model.name.table) .map(_.code.mkString("\n")) .mkString("\n\n") @@ -146,12 +146,12 @@ class Generator(pkg: String, (if (ddlEnabled) { "\n/** DDL for all tables. Call .create to execute. */" + ( - if (schemaTables.length > 5) - "\nlazy val schema: profile.SchemaDescription = Array(" + schemaTables + if (tables.length > 5) + "\nlazy val schema: profile.SchemaDescription = Array(" + tables .map(_.TableValue.name + ".schema") .mkString(", ") + ").reduceLeft(_ ++ _)" - else if (schemaTables.nonEmpty) - "\nlazy val schema: profile.SchemaDescription = " + schemaTables + else if (tables.nonEmpty) + "\nlazy val schema: profile.SchemaDescription = " + tables .map(_.TableValue.name + ".schema") .mkString(" ++ ") else |