[2.4-scala] Problems with evolutions using Play and Slick

347 views
Skip to first unread message

Fokko Driesprong

unread,
Jun 2, 2015, 2:57:32 AM6/2/15
to play-fr...@googlegroups.com
Hi Guys,

I am working with the new 2.4 Play framework using Slick. I am using the play-slick plugin which makes Slick a first-class citizen in Play. I am trying to develop an app which accepts an JSON object and stores them into a MySQL database. I got the part of the JSON validation and queries working, but the evolutions plugin isn't working and therefore the table definitions aren't created when starting play. 
I am running play, started using SBT and it is running in DEV mode. Is there any way to force to run the evolutions, I have the idea that I forgot to register the plugin somewhere, but searched for quite some while now but I can't find the answer.

Furthermore, at setting the config I noticed something that looks peculiar to me:

slick.dbs.default.driver="slick.driver.MySQLDriver$"
slick.dbs.default.db.driver=com.mysql.jdbc.Driver
slick.dbs.default.db.url="jdbc:mysql://localhost/play"
slick.dbs.default.db.user="fokko"
slick.dbs.default.db.password=""

Why is the $ after the driver required, and what is it's use? When I remove the dollar sign, I get an error Cannot connect to database [default], while the credentials are correct. When I add the sign, the play-app starts but the evolutions plugin still isn't triggered. 

Mirko Stocker

unread,
Jun 2, 2015, 3:23:42 AM6/2/15
to play-fr...@googlegroups.com
On Monday 01 June 2015 23.57:32 Fokko Driesprong wrote:
> Why is the $ after the driver required, and what is it's use?

You typically don't see them when you program in Scala, but when you create an
object, it has a trailing $ in the name to distinguish it from the
corresponding class. So in this case, this simply refers to the MySQLDriver$
object.

You can also see it in the documentation's url:

http://slick.typesafe.com/doc/3.0.0/api/index.html#slick.driver.MySQLDriver$

Unfortunately, I can't help you with the evolutions issue.

Cheers

Mirko

--
Mirko Stocker | mi...@stocker.email
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st

Fokko Driesprong

unread,
Jun 2, 2015, 3:32:10 AM6/2/15
to play-fr...@googlegroups.com, mi...@stocker.email
Thanks Mirko, makes sense now. Also the documentation does not encapsulate the driver-string with quotes, which is required. But I don't know who maintains the documents.

Regarding the evolutions issue, I put the project up in Github: https://github.com/Fokko/diabetes-display. It is quite minimal at the moment.

Cheers,
Fokko

Op dinsdag 2 juni 2015 09:23:42 UTC+2 schreef Mirko Stocker:

Mirco Dotta

unread,
Jun 2, 2015, 4:40:31 AM6/2/15
to play-fr...@googlegroups.com
Thanks Mirko, makes sense now. Also the documentation does not encapsulate the driver-string with quotes, which is required. But I don't know who maintains the documents.

Regarding the evolutions issue, I put the project up in Github: https://github.com/Fokko/diabetes-display. It is quite minimal at the moment.

Where are your evolutions?


Cheers,
Fokko

Op dinsdag 2 juni 2015 09:23:42 UTC+2 schreef Mirko Stocker:
On Monday 01 June 2015 23.57:32 Fokko Driesprong wrote: 
> Why is the $ after the driver required, and what is it's use? 

You typically don't see them when you program in Scala, but when you create an 
object, it has a trailing $ in the name to distinguish it from the 
corresponding class. So in this case, this simply refers to the MySQLDriver$ 
object. 

You can also see it in the documentation's url: 

http://slick.typesafe.com/doc/3.0.0/api/index.html#slick.driver.MySQLDriver$ 

Unfortunately, I can't help you with the evolutions issue. 

Cheers 

Mirko 

-- 
Mirko Stocker | mi...@stocker.email 
Work: http://ifs.hsr.ch | http://infoq.com 
Personal: http://misto.ch | http://twitter.com/m_st 

-- 
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/5f050510-66ef-4eb9-b780-066193469e02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

signature.asc

Fokko Driesprong

unread,
Jun 2, 2015, 5:19:48 AM6/2/15
to play-fr...@googlegroups.com
Do you have to write them by yourself? In previous versions of Slick they are generated for you, so I assumed that this is also the case in version 3.0.

Op dinsdag 2 juni 2015 10:40:31 UTC+2 schreef Mirco Dotta:

Mirco Dotta

unread,
Jun 2, 2015, 5:22:14 AM6/2/15
to play-fr...@googlegroups.com
Yes, you do in play-slick 1.0. This is mentioned in the migration doc https://www.playframework.com/documentation/2.4.x/PlaySlickMigrationGuide#DDL-support-was-removed

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

Typesafe – Build reactive apps!

signature.asc

Fokko Driesprong

unread,
Jun 2, 2015, 5:24:51 AM6/2/15
to play-fr...@googlegroups.com
Ah my bad, this was not obvious for me. I will write them by myself, no problem at all. Thanks guys, and keep up the good work. I am enjoying Scala, Play and Slick very much.

Op dinsdag 2 juni 2015 11:22:14 UTC+2 schreef Mirco Dotta:

Mirco Dotta

unread,
Jun 2, 2015, 5:30:43 AM6/2/15
to play-fr...@googlegroups.com
Very happy to hear you are having fun with Play, Slick and Scala!

— Mirco

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

Typesafe – Build reactive apps!

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