我想使用最新的Slick(3.1.1)分析遗留的mysql数据库(myisam引擎)。
但是,在该数据库上运行slick.codegen.SourceCodeGenerator会导致错误:
slick.SlickException: Could not parse default value Some(0000-00-00 00:00:00) for column foo.bar.baz of type java.sql.Timestamp, meta data: MColumn(MQName(foo.bar),baz,93,DATETIME,Some(19),None,10,Some(false),Some(),Some(0000-00-00 00:00:00),0,1,Some(false),None,None,Some(false))
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.convenientDefault(JdbcModelBuilder.scala:270)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.model(JdbcModelBuilder.scala:279)
at slick.jdbc.JdbcModelBuilder$TableBuilder$$anonfun$columns$1.apply(JdbcModelBuilder.scala:161)
...
Caused by: scala.MatchError: (0000-00-00 00:00:00,java.sql.Timestamp) (of class scala.Tuple2)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder$$anonfun$default$1.apply(JdbcModelBuilder.scala:215)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder$$anonfun$default$1.apply(JdbcModelBuilder.scala:212)
at scala.Option.map(Option.scala:146)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.default(JdbcModelBuilder.scala:212)
at slick.driver.MySQLDriver$ModelBuilder$$anon$4.slick$driver$MySQLDriver$ModelBuilder$$anon$$super$default(MySQLDriver.scala:71)
at slick.driver.MySQLDriver$ModelBuilder$$anon$4$$anonfun$default$3.apply(MySQLDriver.scala:71)
at slick.driver.MySQLDriver$ModelBuilder$$anon$4$$anonfun$default$3.apply(MySQLDriver.scala:70)
at scala.Option.getOrElse(Option.scala:121)
at slick.driver.MySQLDriver$ModelBuilder$$anon$4.default(MySQLDriver.scala:70)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder$$anonfun$defaultColumnOption$3.apply(JdbcModelBuilder.scala:252)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder$$anonfun$defaultColumnOption$3.apply(JdbcModelBuilder.scala:252)
at scala.Option.getOrElse(Option.scala:121)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.defaultColumnOption(JdbcModelBuilder.scala:251)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.convenientDefault(JdbcModelBuilder.scala:261)
at slick.jdbc.JdbcModelBuilder$ColumnBuilder.model(JdbcModelBuilder.scala:279)
at slick.jdbc.JdbcModelBuilder$TableBuilder$$anonfun$columns$1.apply(JdbcModelBuilder.scala:161)
...
相关表格(DDL代码)如下所示:
CREATE TABLE `bar` (`baz` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00') ENGINE=MyISAM
出了什么问题?怎么解决?