From 95409613fe6e71ff9aa03fe469a796c08a238b0a Mon Sep 17 00:00:00 2001 From: Lintterer Date: Thu, 12 Sep 2024 09:49:40 +0200 Subject: [PATCH] feat: view code generation --- .bsp/sbt.json | 2 +- .java-version | 1 + build.sbt | 2 +- .../play/db/codegen/CustomizedCodeGeneratorBase.scala | 4 +++- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 .java-version diff --git a/.bsp/sbt.json b/.bsp/sbt.json index 63a616a..e3fbc35 100755 --- a/.bsp/sbt.json +++ b/.bsp/sbt.json @@ -1 +1 @@ -{"name":"sbt","version":"1.5.0","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/Users/jona7o/.sdkman/candidates/java/11.0.13.8.1-amzn/bin/java","-Xms100m","-Xmx100m","-classpath","/Users/jona7o/Library/Application Support/JetBrains/IntelliJIdea2021.2/plugins/Scala/launcher/sbt-launch.jar","xsbt.boot.Boot","-bsp","--sbt-launch-jar=/Users/jona7o/Library/Application%20Support/JetBrains/IntelliJIdea2021.2/plugins/Scala/launcher/sbt-launch.jar"]} \ No newline at end of file +{"name":"sbt","version":"1.6.2","bspVersion":"2.0.0-M5","languages":["scala"],"argv":["/Users/moritzlintterer/.sdkman/candidates/java/11.0.21-zulu/zulu-11.jdk/Contents/Home/bin/java","-Xms100m","-Xmx100m","-classpath","/Users/moritzlintterer/Library/Application Support/JetBrains/IntelliJIdea2024.2/plugins/Scala/launcher/sbt-launch.jar","-Dsbt.script=/Users/moritzlintterer/.sdkman/candidates/sbt/current/bin/sbt","xsbt.boot.Boot","-bsp"]} \ No newline at end of file diff --git a/.java-version b/.java-version new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +11 diff --git a/build.sbt b/build.sbt index b6600da..addd299 100755 --- a/build.sbt +++ b/build.sbt @@ -3,7 +3,7 @@ import sbt.{ Def, _ } //settings name := """scala-utils""" -val releaseVersion = "1.5.7" +val releaseVersion = "1.5.7-View" val token = sys.env.getOrElse("GITHUB_TOKEN", "") diff --git a/util-play/src/main/scala/de/innfactory/play/db/codegen/CustomizedCodeGeneratorBase.scala b/util-play/src/main/scala/de/innfactory/play/db/codegen/CustomizedCodeGeneratorBase.scala index 16735e7..d383cb3 100755 --- a/util-play/src/main/scala/de/innfactory/play/db/codegen/CustomizedCodeGeneratorBase.scala +++ b/util-play/src/main/scala/de/innfactory/play/db/codegen/CustomizedCodeGeneratorBase.scala @@ -2,6 +2,7 @@ package de.innfactory.play.db.codegen import com.github.tminglei.slickpg.ExPostgresProfile import slick.codegen.SourceCodeGenerator +import slick.jdbc.meta.MTable import slick.sql.SqlProfile.ColumnOption import scala.concurrent.duration._ @@ -94,7 +95,8 @@ abstract class CustomizedCodeGeneratorBase[T <: ExPostgresProfile](customizedCod val db = slickProfile.api.Database.forURL(config.url, driver = config.jdbcDriver) lazy val codegen: Future[SourceCodeGenerator] = db.run { - config.slickProfile.defaultTables.map(_.filter(t => included contains t.name.name.toUpperCase)) + MTable.getTables(None, None, Some("%"), Some(Seq("TABLE", "VIEW"))) + .map(_.filter(t => included contains t.name.name.toUpperCase)) .flatMap( config.slickProfile .createModelBuilder(_, ignoreInvalidDefaults = false)