Where to initialize a database in Play Framework 2.4 using Slick 3?

Slick 3.0.2 does not automatically create a database table when it does not exist, so you need to do something like:

  val setup = DBIO.seq(
      (table1.schema ++ table2.schema).create,
//...
    )

Where do you put this code in Play 2.4?

Persistent binding?

https://www.playframework.com/documentation/2.4.x/ScalaDependencyInjection#Eager-bindings

+4
source share
1 answer

From the perspective of framework developers, you should use evolution to define your schema.

https://www.playframework.com/documentation/2.4.x/Evolutions https://www.playframework.com/documentation/2.4.x/PlaySlick

, , Slick.

- , .

, .

0

Source: https://habr.com/ru/post/1606687/


All Articles