6

I am still developing first version of my application on play 2. How could I regenerate evolution scripts?

Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
angelokh
  • 9,426
  • 9
  • 69
  • 139

2 Answers2

8

Disclaimer: it will destroy your existing database and create new one!

The auto-evolution will auto-regenerate when:

  • you are running your app in the dev mode
  • in application.conf you have this line not commented : ebean.default="models.*"
  • there is only one file in your evolutions folder and it's 1.sql
  • it has this comment at the beginning:

# --- Created by Ebean DDL

biesior
  • 55,576
  • 10
  • 125
  • 182
  • 1
    I found out the script only re-generates when I execute 'play test'. If I do 'play clean' or 'play compile', it wouldn't. Do you know what command is required to make evolution script re-generate? – angelokh Jun 07 '12 at 00:37
  • @angelokh - sorry, I didn't find your comment before :? probably you found an answer after such a long time, however, of course re-generation works in `dev` mode only – biesior Nov 01 '12 at 21:25
0

Using play 2.4, Slick 3.0.3 & postgres the *.sql files placed in the evolution folder were automatically generated in Heroku using the following setup:

in build.sbt:

  "com.typesafe.play" %% "play-slick" % "1.0.1",
  "com.typesafe.play" %% "play-slick-evolutions" % "1.0.1",
  "com.typesafe.slick" %% "slick" % "3.0.3",
  "org.postgresql" % "postgresql" % "9.4-1201-jdbc41",
  "org.slf4j" % "slf4j-nop" % "1.6.4",

in application.conf:

slick.dbs.default.driver ="slick.driver.PostgresDriver$"
slick.dbs.default.db.dataSourceClass = "slick.jdbc.DatabaseUrlDataSource"
slick.dbs.default.db.properties.driver = "org.postgresql.Driver"

and in Procfile:

-Dplay.evolutions.db.default.autoApply = true

Cheers