@@ -58,6 +58,9 @@ object CodegenPlugin extends sbt.AutoPlugin with PluginDBSupport {
5858 lazy val slickCodegenCodeGenerator : SettingKey [m.Model => SourceCodeGenerator ] =
5959 settingKey[m.Model => SourceCodeGenerator ](" Function to create CodeGenerator to be used" )
6060
61+ lazy val slickCodegenIncludedTableTypes : SettingKey [Seq [String ]] =
62+ settingKey[Seq [String ]](" Table types that slick schema can be generated for" )
63+
6164 lazy val slickCodegenExcludedTables : SettingKey [Seq [String ]] =
6265 settingKey[Seq [String ]](" Tables that should be excluded" )
6366
@@ -150,6 +153,7 @@ object CodegenPlugin extends sbt.AutoPlugin with PluginDBSupport {
150153 val driver = slickCodegenDriver.value
151154 val url = postgresDbUrl.value
152155 val jdbcDriver = slickCodegenJdbcDriver.value
156+ val tableTypes = slickCodegenIncludedTableTypes.value
153157 val excluded = slickCodegenExcludedTables.value
154158 val included = slickCodegenIncludedTables.value
155159 val database = driver.api.Database .forURL(url = url, driver = jdbcDriver, user = dbUser, password = dbPass)
@@ -163,7 +167,7 @@ object CodegenPlugin extends sbt.AutoPlugin with PluginDBSupport {
163167 }
164168
165169 val tables = MTable
166- .getTables(None , None , None , Some (Seq ( " TABLE " , " VIEW " , " MATERIALIZED VIEW " ) ))
170+ .getTables(None , None , None , Some (tableTypes ))
167171 .map(ts => ts.filter(t => included.isEmpty || (included contains t.name.name)))
168172 .map(ts => ts.filterNot(t => excluded contains t.name.name))
169173
@@ -182,6 +186,7 @@ object CodegenPlugin extends sbt.AutoPlugin with PluginDBSupport {
182186 slickCodegenOutputToMultipleFiles := false ,
183187 slickCodegenOutputDir := (Compile / Keys .scalaSource).value,
184188 slickCodegenOutputContainer := " Tables" ,
189+ slickCodegenIncludedTableTypes := Seq (" TABLE" , " PARTITIONED TABLE" , " VIEW" , " MATERIALIZED VIEW" ),
185190 slickCodegenExcludedTables := Seq (),
186191 slickCodegenIncludedTables := Seq (),
187192 slickCodegenCodeGenerator := { (m) => new CustomizeSourceCodeGenerator (m, slickCodegenGeneratorConfig.value) },
0 commit comments