How to write database-agnostic Play application and perform first-time database initialization?

后端 未结 4 1512
生来不讨喜
生来不讨喜 2020-12-22 17:45

I\'m using Slick with a Play Framework 2.1 and I have some troubles.

Given the following entity...

package models

import scala.slick.driver.Postgres         


        
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-22 18:34

    The play-slick does exactly the same as what is proposed in the other answers, and it seems to be under the umbrella of Play/Typesafe.

    You just can import import play.api.db.slick.Config.driver.simple._ and it will choose the appropriate driver according to conf/application.conf.

    It also offers some more things like connection pooling, DDL generation...

提交回复
热议问题