Last active
December 23, 2015 03:33
-
-
Save yohei1126/f1d67f8bc125e8e4776d to your computer and use it in GitHub Desktop.
Play 2.3.xから2.4.x、Slick 2.xから3.1.xへの移行 ref: http://qiita.com/yohei1126@github/items/d60c6e498bc57c07b880
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.4.0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbt.version=0.13.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
play.evolutions.enabled=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slick.dbs.default.driver="slick.driver.H2Driver$" | |
slick.dbs.default.db.driver=org.h2.Driver | |
slick.dbs.default.db.url="jdbc:h2:mem:play" | |
slick.dbs.default.db.user=sa | |
slick.dbs.default.db.password="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import play.api.db.slick.Config.driver.simple._. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Application @Inject() (dbConfigProvider: DatabaseConfigProvider, messagesApi: MessagesApi) extends Controller with I18nSupport { | |
val dbConfig = dbConfigProvider.get[JdbcProfile] | |
import dbConfig._ | |
import driver.api._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index(name: String) = Action.async { implicit request => | |
val resultingUsers: Future[Seq[User]] = dbConfig.db.run(Users.filter(_.name === name).result) | |
resultingUsers.map(users => Ok(views.html.index(users))) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
routesGenerator := InjectedRoutesGenerator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GET /some/path @controllers.Application.index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Application @Inject() (dbConfigProvider: DatabaseConfigProvider, messagesApi: MessagesApi) extends Controller with I18nSupport { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Singleton | |
class YoutSingletonClass @Inject(yourParameter: YourClass) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(implicit messages: Messages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Application @Inject() (dbConfigProvider: DatabaseConfigProvider, messagesApi: MessagesApi) extends Controller with I18nSupport { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
play.i18n.langs = [ "en" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libraryDependencies ++= Seq( | |
... | |
evolutions, | |
"com.typesafe.play" % "play-slick_2.11" % "1.1.1", | |
"com.typesafe.play" %% "play-slick-evolutions" % "1.1.1", | |
... | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment