aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Stewart <stewinsalot@gmail.com>2017-02-15 12:39:13 -0800
committerStewart Stewart <stewinsalot@gmail.com>2017-02-15 12:39:26 -0800
commit262d532e30132c2623e63cec6a6386e1bcb35454 (patch)
treea76641c3a74d415a7df941f4db5b677095f38175
parent358c81c1b19168f52e3993410cd09eed423d9def (diff)
downloadslick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.tar.gz
slick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.tar.bz2
slick-codegen-plugin-262d532e30132c2623e63cec6a6386e1bcb35454.zip
override tables
-rw-r--r--src/main/scala/NamespacedCodegen.scala20
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