Giter Club home page Giter Club logo

Comments (7)

cbrachem avatar cbrachem commented on June 15, 2024

I have a solution for this using the Scala 2.10 reflection API. Loading custom Slick drivers works (I tested the MariaDB JDBC driver with the MySQL Slick driver).
However, there is the issue of configuration: Right now, the only play-slick configuration option is slick.default="models.*" (or similar). Like this, slick.default is already defined as a string, and it is impossible to set a key slick.default.driver.
Also, SlickDDLPlugin reads all children of the slick configuration key, so a simple hack like setting slick.driver=scala.slick.H2Driver won't work.

Possible solutions would be to work around this with two root-level configuration keys, à la

slick.default="models.*"
slickdrivers.default="scala.slick.driver.MySQLDriver"

I think this is sort of hacky, though. A cleaner solution would be to change the configuration to something like this:

slick.default.models="models.*"
slick.default.driver="scala.slick.H2Driver"

Any thoughts on this?

from play-slick.

freekh avatar freekh commented on June 15, 2024

I like it :) there is a possibility you get a conflict between the url driver and this setting but since it is optional it is fair to assume that the user knows what he is doing.
Want to create a PR?

Carsten Brachem [email protected] wrote:

I have a solution for this using the Scala 2.10 reflection API. Loading
custom Slick drivers works (I tested the MariaDB JDBC driver with the
MySQL Slick driver).
However, there is the issue of configuration: Right now, the only
play-slick configuration option is slick.default="models.*" (or
similar). Like this, slick.default is already defined as a string,
and it is impossible to set a key slick.default.driver.
Also,
SlickDDLPlugin
reads all children of the slick configuration key, so a simple hack
like setting slick.driver=scala.slick.H2Driver won't work.

Possible solutions would be to work around this with two root-level
configuration keys, à la

slick.default="models.*"
slickdrivers.default="scala.slick.driver.MySQLDriver"

I think this is sort of hacky, though. A cleaner solution would be to
change the configuration to something like this:

slick.default.models="models.*"
slick.default.driver="scala.slick.H2Driver"

Any thoughts on this?


Reply to this email directly or view it on GitHub:
#25 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

from play-slick.

cbrachem avatar cbrachem commented on June 15, 2024

I agree on the possible conflict: this is the same thing that you have with plain Slick. If you wanted to, you could choose the wrong database driver (or create a custom nonsense driver). It's great of play-slick that it removes the chance to get it wrong for most configurations, but if someone wants to, they should be able to choose their Slick driver.

But:
I cannot create a PR yet because I don't know how to proceed on the configuration issue. I have suggested two possible solutions, one with the two root-level configuration keys, and the other one that is cleaner (everything is unter slick.*), but changes the current configuration and breaks all current projects using play-slick.
I'd happily implement either of these solutions (or something completely different). But this issue is too big for me to decide on; also, I don't have the necessary insight into the project and its plans to make an informed suggestion. What's your stand on this?

from play-slick.

freekh avatar freekh commented on June 15, 2024

Ok - right. i will have a look at it tomorrow

from play-slick.

v6ak avatar v6ak commented on June 15, 2024

I've done that in my fork: v6ak@3690072

There is the pull request: #110

from play-slick.

freekh avatar freekh commented on June 15, 2024

Awesome stuff! Thanks for this! Will review on Wednesday and put out a new if there is no hick-ups.

"Vít Šesták" [email protected] wrote:

I've done that in my fork:
v6ak@3690072

There is the pull request:
#110


Reply to this email directly or view it on GitHub:
#25 (comment)

Sent from my Android device with K-9 Mail. Please excuse my brevity.

from play-slick.

freekh avatar freekh commented on June 15, 2024

Closing this since PR is merged

from play-slick.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.