diff options
Diffstat (limited to 'src')
-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 |