evolution is not running (play slick and play-slick-evolution)

1,798 views
Skip to first unread message

Hengky Sucanda

unread,
Jun 4, 2015, 12:16:50 AM6/4/15
to play-fr...@googlegroups.com
Hi Guys,

So i have added both play-slick and play-slick-evolution on my project, and i have also written my evolution scripts under conf/evolutions/mydb. I restart the app but evolution is still not running. Did i miss anything?

//my conf in application.conf
slick.dbs.heroku.driver="slick.driver.PostgresDriver$"
slick.dbs.heroku.db.driver=org.postgresql.Driver
slick.dbs.heroku.db.url="someurl"


Hengky Sucanda

unread,
Jun 4, 2015, 12:20:27 AM6/4/15
to play-fr...@googlegroups.com
Im on play 2.4, play-slick 1.0.0 and play-slick-evolution 1.0.0

Mirco Dotta

unread,
Jun 4, 2015, 4:21:27 AM6/4/15
to play-framework

What's the exception you are getting?

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/7c31b474-2030-476a-b6b5-2d5e3bfe8737%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hengky Sucanda

unread,
Jun 4, 2015, 5:34:17 AM6/4/15
to play-fr...@googlegroups.com
There's no exception. It's just the evolution plugin is not running at all (no apply evolution script)

Alexander Sedov

unread,
Jun 15, 2015, 2:47:39 PM6/15/15
to play-fr...@googlegroups.com
The same issue. No exception and evolutions don't run. My config is

play {
  crypto.secret = "..."
  i18n.langs = [ "en" ]
  evolutions {
    enabled = true
    autocommit = false
  }
  http.filters = "filters.Filters"
  modules.enabled += "config.RepositoryModule"
  modules.enabled += "config.ServiceModule"
  modules.enabled += "config.QueryModule"
  modules.enabled += "config.SilhouetteModule"
  modules.enabled += "config.ControllerModule"
  modules.enabled += "config.BootstrapModule"
}
slick.dbs {
  default {
    driver = "slick.driver.PostgresDriver$"
    db {
      driver = "org.postgresql.Driver"
      url = "jdbc:postgresql://localhost:5432/mydb"
      user="postgres"
      password="..."
    }
  }
}

silhouette = { include "silhouette.conf" }


and conf/evolutions/default/1.sql exists. Here is my build.sbt
name := "myapp"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.11.6"

libraryDependencies ++= Seq(
  cache,
  ws,
  filters,
  specs2 % Test
)

libraryDependencies ++= Seq(
  "com.typesafe.slick"          %% "slick"                  % "3.0.0",
  "com.typesafe.slick"          %% "slick-codegen"          % "3.0.0",
  "com.typesafe.play"           %% "play-slick"             % "1.0.0",
  "com.typesafe.play"           %% "play-slick-evolutions"  % "1.0.0",
  "org.postgresql"              %  "postgresql"             % "9.4-1201-jdbc41",
  "com.mohiva"                  %% "play-silhouette"        % "3.0.0-RC1",
  "net.codingwell"              %% "scala-guice"            % "4.0.0"
)

resolvers += "Atlassian Releases" at "https://maven.atlassian.com/public/"
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"

// Play provides two styles of routers, one expects its actions to be injected, the
// other, legacy style, accesses its actions statically.
routesGenerator := InjectedRoutesGenerator



четверг, 4 июня 2015 г., 12:34:17 UTC+3 пользователь Hengky Sucanda написал:

Mirco Dotta

unread,
Jun 15, 2015, 3:32:55 PM6/15/15
to play-fr...@googlegroups.com
Does it work if you use H2 as DB? (I expect it doesn’t)

If you can push somewhere a self-contained project with as few dependencies as possible (ideally, only play-slick and play-slick-evolutions) that I can use to reproduce the issue, I’ll be happy to have a look.

Thanks,
Mirco
----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

signature.asc

Alexander Sedov

unread,
Jun 15, 2015, 4:04:43 PM6/15/15
to play-fr...@googlegroups.com
Thank you for your reply! See the attached zip for the project sample. It was created with Typesafe Activator "play-scala" template. Only 1.sql and application.conf were changed. So I run the application with 
sbt run
command and check if new table appeared in the database.


понедельник, 15 июня 2015 г., 22:32:55 UTC+3 пользователь Mirco Dotta написал:
test-app.zip

Marco Schweighauser

unread,
Jun 15, 2015, 4:15:34 PM6/15/15
to play-fr...@googlegroups.com
Evolutions with Slick3 are working for me. This is the config I use:

# Database configuration
# ~~~~~
slick.dbs.default.driver="slick.driver.PostgresDriver$"
slick.dbs.default.db.driver="org.postgresql.Driver"
slick.dbs.default.db.url=
slick
.dbs.default.db.user=
slick
.dbs.default.db.password=

# Evolutions
# ~~~~~
play.evolutions.db.default.enabled=true
Enter code here...

Also the evolution scripts are in: 'conf/evolutions/default' => '1.sql', '2.sql' and so on.

I see that you have made a DB config for 'heroku' but your evolutions are in 'mydb'.

Mirco Dotta

unread,
Jun 16, 2015, 1:11:50 AM6/16/15
to play-fr...@googlegroups.com
The reason why evolutions aren’t working for you is that the evolutions files must be placed in `evolutions/<db-name>`, not in `evolutions.<db-name>`.

Therefore, to have evolutions working for the project attached to your last email, rename `evolutions.default` to `evolutions` and create an additional folder named `default` inside `evolutions`. Place your evolutions scripts there and things will work as expected.

Cheers,
Mirco
----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!


For more options, visit https://groups.google.com/d/optout.
<test-app.zip>

signature.asc

Damir Vandic

unread,
Jun 16, 2015, 3:03:44 AM6/16/15
to play-fr...@googlegroups.com
I had the exact same issue the other day, i.e., I was using the folder "evolutions.default" instead of "evolutions/default". I can confirm that play-evolutions now works fine for me.

Kind regards,

Damir Vandic | Ontostream


Alexander Sedov

unread,
Jun 16, 2015, 3:47:19 PM6/16/15
to play-fr...@googlegroups.com
Thank you so much! I spent hours tiyng to figure out what was wrong. Switched off IDEA's "Compact Empty Middle Packages" :)

вторник, 16 июня 2015 г., 8:11:50 UTC+3 пользователь Mirco Dotta написал:

Mirco Dotta

unread,
Jun 17, 2015, 1:19:02 AM6/17/15
to play-fr...@googlegroups.com
Oooh, I see now why there are so many having the same issue. I did not know there was a feature in IntelliJ doing that, thanks for sharing!

— Mirco

----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

signature.asc

Brian Voong

unread,
Jun 17, 2015, 5:55:03 AM6/17/15
to play-fr...@googlegroups.com
I still can't get my first evolution to run using play 2.4 with in memory db setup via:
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:play"
db.default.username=sa
db.default.password=""

and 1.sql as the 2.4 docs outline:
# Users schema

# --- !Ups

CREATE TABLE User (
id bigint(20) NOT NULL AUTO_INCREMENT,
email varchar(255) NOT NULL,
password varchar(255) NOT NULL,
fullname varchar(255) NOT NULL,
isAdmin boolean NOT NULL,
PRIMARY KEY (id)
);

# --- !Downs

Brian Voong

unread,
Jun 17, 2015, 5:56:51 AM6/17/15
to play-fr...@googlegroups.com
And the path for 1.sql is:

~/Documents/play_sandbox/scalastore/conf/evolutions/default/1.sql

Mirco Dotta

unread,
Jun 17, 2015, 6:55:28 AM6/17/15
to play-fr...@googlegroups.com
Hi Brian,

Is this a question about using evolution with play-slick? If so, then the issue is your database configuration, the key should be slick.dbs.default, and not db.default. See https://www.playframework.com/documentation/2.4.x/PlaySlick#Database-Configuration

— Mirco
----------------
Mirco Dotta - @mircodotta

Typesafe – Build reactive apps!

signature.asc
Reply all
Reply to author
Forward
0 new messages