我正在尝试使用slick codegen根据 SQLServer 中的现有数据创建一个 Tables.scala 文件,并具有以下设置:
slick.codegen.SourceCodeGenerator.main(Array("slick.jdbc.SQLServerProfile",
"com.microsoft.sqlserver.jdbc.SQLServerDriver",
"jdbc:sqlserver://myserver.com:1433;applicationName=TestCodeGen;integratedSecurity=true;authenticationScheme=NativeAuthentication;databaseName=MYDB",
"src/main/scala/",
"com.mypackage",
"myUserId",
""))
当我运行命令时,我没有收到任何错误,但会生成一个空的 Tables.scala 文件(数据库中有几十个表):
package com.mypackage
// AUTO-GENERATED Slick data model
/** Stand-alone Slick data model for immediate use */
object Tables extends {
val profile = slick.jdbc.SQLServerProfile
} with Tables
/** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
trait Tables {
val profile: slick.jdbc.JdbcProfile
import profile.api._
import slick.model.ForeignKeyAction
/** DDL for all tables. Call .create to execute. */
lazy val schema: profile.SchemaDescription = profile.DDL(Nil, Nil)
@deprecated("Use .schema instead of .ddl", "3.0")
def ddl = schema
}
我的怀疑是 SQLServer 使用 dbo 模式这一事实存在问题,但该模式未在 codegen 调用的任何地方指定(所有表都命名为“dbo..TableName”)。
所以我的问题是:我是否需要在 codegen 配置中的某处指定“dbo”,如果需要,怎么做?
如果答案是不需要做任何事情,那么我如何调试 codegen 显然失败但没有产生错误的事实?
预先感谢您的考虑和回复。