In my tests, I'm trying to setup a test database based on the schema defined in slick, which in turn is generated with the slick code generator based on an existing database. To do so, I'm extending WithApplication and redefining the around method like so:
abstract class WithDbData extends WithApplication {
def ds = DB.getDataSource("test")
def slickDb = Database.forDataSource(ds)
override def around[T: AsResult](t: => T): Result = super.around {
setup
val result = AsResult.effectively(t)
teardown
result
}
def setup = {
slickDb.withSession { implicit session =>
ddl.create
}
}
def teardown = {
slickDb.withSession { implicit session =>
ddl.drop
}
}
}
But when I run the tests, I'm getting a
MySqlSyntaxErrorException : Column length too big for column 'text' (max = 21845); use BLOB or TEXT instead (null:-2).
I'm using MySql for development and for testing, and part of the schema generated by the code generator is like so:
/** Database column text DBType(TEXT), Length(65535,true) */
val text: Column[String] = column[String]("text", O.Length(65535,varying=true))
It seems that the ddl generator is trying to create the text column as a varchar or something like that, instead of as text, as it was originally intended, because in the original database that column is of type text.
In the autogenerated slick data model I have as profile = scala.slick.driver.MySQLDriver, I've also imported scala.slick.driver.MySQLDriver.simple._ in my test class so I shouldn't have any problem because of mixing drivers.
I'm using play 2.3, slick 2.1.0, codegen 2.1.0 and play-slick 0.8.0.
I'd appreciate any light on this matter.