4

Slick 3.0.2 doesn't automatically create the database table when they don't exist so you have to do something like:

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

Where do you put this code in Play 2.4?

On a eager binding?

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

Luis F.
  • 1,222
  • 1
  • 11
  • 12

1 Answers1

0

From the point of view of play framework developers you should use evolutions to define your schema.

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

Of course, that might be a bit boring and kind of repetitive work as you also define your model in Slick.

If you want to run some code on startup an eager binding is the way to go.

If you have problems with eager bindings please, let us know.

Jonas Anso
  • 2,057
  • 14
  • 13