I am trying to upgrade my application from using Play 2.3.x to Play 2.4.x (will end at 2.6, but going one step at a time) and Slick from 2.1.0 to 3.1.1.
I have done my best to follow Play's migration guide, the Play Slick migration guide, and the Slick upgrade guides.
One of the problems I'm having right now is with the following line:
val db: slick.Database = play.api.db.slick.DB
This no longer seems to be the correct way to do this b/c I get errors like:
value withTransaction is not a member of play.api.db.slick.Database
From the Play slick migration guide, it seems like I should modify this to something like
val dbConfig = DatabaseConfigProvider.get[JdbcProfile](Play.current)
But idk if I just don't have the right imports or what, but I get errors like:
object driver is not a member of package play.api.db.slick
not found: value DatabaseConfigProvider
For more context, here is one of the files I'm working with that gives this error: https://github.com/ProjectSidewalk/SidewalkWebpage/blob/2c48dfa2e34c691e40568bfa9d50493aa3fe9971/app/models/attribute/GlobalAttributeTable.scala
Anyone know what I missed among these migration guides?
Thank you in advance!
Turns out that I was missing a few things:
import play.api.Play
instead of the import import play.api.Play.current
that I already had.import play.api.db.slick
that was causing the "object driver is not a member of package play.api.db.slick" error at the line with this import: import slick.driver.JdbcProfile
. I just removed the former import that was not needed.withTransaction
has been removed in Slick 3.1, and the replacement is documented in the various links in the comments above.