From cd9c69800812ab9bad524715538503971035e6b2 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 08:47:48 -0800 Subject: [PATCH 1/9] Update the docs and formatting (cherry picked from commit 0cb4db1767555378a7c48d10762f7426a394d4f6) --- CONTRIBUTING.md | 2 +- README.md | 2 +- .../scalaGuide/main/sql/slick/PlaySlick.md | 16 ++++++++-------- .../main/sql/slick/PlaySlickAdvancedTopics.md | 10 +++++----- .../scalaGuide/main/sql/slick/PlaySlickFAQ.md | 4 ++-- .../main/sql/slick/PlaySlickMigrationGuide.md | 4 ++-- .../scalaGuide/main/sql/slick/code/DI.scala | 2 +- .../scalaGuide/main/sql/slick/code/Example.scala | 2 +- .../main/sql/slick/code/UsersSchema.scala | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c2697a7f..dd6178b8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,7 +8,7 @@ Before making a contribution, it is important to make sure that the change you w ### Procedure -1. Make sure you have signed the [Typesafe CLA](http://www.typesafe.com/contribute/cla); if not, sign it online. +1. Make sure you have signed the [Lightbend CLA](https://www.lightbend.com/contribute/cla); if not, sign it online. 2. Ensure that your contribution meets the following guidelines: 1. Live up to the current code standard: - Not violate [DRY](http://programmer.97things.oreilly.com/wiki/index.php/Don%27t_Repeat_Yourself). diff --git a/README.md b/README.md index ee9b3bf5..1a564528 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ The Play Slick module makes [Slick] a first-class citizen of [Play]. It consists Because Slick creates and manages both a connection pool and a thread pool, integrating Slick with Play boils down to ensuring that all resources allocated by Slick are shutdown when a Play application is stopped (or reloaded). [Play]: https://www.playframework.com -[Slick]: http://slick.typesafe.com +[Slick]: https://scala-slick.org/ The plugin has its own release cycle and therefore is not integrated into either core Play or Slick. diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md index f4bdc8e1..4c3e003c 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md @@ -1,19 +1,19 @@ # Using Play Slick -The Play Slick module makes [Slick](http://slick.typesafe.com/) a first-class citizen of Play, and consists of two primary features: +The Play Slick module makes [Slick](https://scala-slick.org/) a first-class citizen of Play, and consists of two primary features: - Integration of Slick into Play's application lifecycle. - Support for [[Play database evolutions|Evolutions]]. -Play Slick currently supports Slick 3.3 with Play 2.7, for Scala 2.12 and Scala 2.11. +Play Slick currently supports Slick 3.3 with Play 2.7 and Play 2.8, for Scala 2.12 and Scala 2.11. > **Note**: This guide assumes you already know both Play 2.7 and Slick 3.3. ## Getting Help -If you are having trouble using Play Slick, check if the [[FAQ|PlaySlickFAQ]] contains the answer. Otherwise, feel free to reach out to [play-framework user group](https://groups.google.com/forum/#!forum/play-framework). Also, note that if you are seeking help on Slick, the [slick user group](https://groups.google.com/forum/#!forum/scalaquery) may be a better place. +If you are having trouble using Play Slick, check if the [[FAQ|PlaySlickFAQ]] contains the answer. Otherwise, feel free to reach out to [play-framework user community](https://discuss.playframework.com). Also, note that if you are seeking help on Slick, the [slick user community](https://scala-slick.org/community/) may be a better place. -Finally, if you prefer to get an answer for your Play and Slick questions in a timely manner, and with a well-defined SLA, you may prefer [to get in touch with Lightbend](http://www.lightbend.com/subscription), as it offers commercial support for these technologies. +Finally, if you prefer to get an answer for your Play and Slick questions in a timely manner, and with a well-defined SLA, you may prefer [to get in touch with Lightbend](https://www.lightbend.com/subscription), as it offers commercial support for these technologies. ## About this release @@ -58,11 +58,11 @@ slick.dbs.default.db.driver="org.h2.Driver" slick.dbs.default.db.url="jdbc:h2:mem:play" ``` -First, note that the above is a valid Slick configuration (for the complete list of configuration parameters that you can use to configure a database see the Slick ScalaDoc for [Database.forConfig](http://slick.typesafe.com/doc/3.1.0/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) - make sure to expand the `forConfig` row in the doc). +First, note that the above is a valid Slick configuration (for the complete list of configuration parameters that you can use to configure a database see the Slick ScalaDoc for [Database.forConfig](http://slick.typesafe.com/doc/3.3.2/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) - make sure to expand the `forConfig` row in the doc). Second, the `slick.dbs` prefix before the database's name is configurable. In fact, you may change it by overriding the value of the configuration key `play.slick.db.config`. -Third, in the above configuration `slick.dbs.default.profile` is used to configure the Slick profile, while `slick.dbs.default.db.driver` is the underlying JDBC driver used by Slick's backend. In the above configuration we are configuring Slick to use H2 database, but Slick supports several other databases. Check the [Slick documentation](http://slick.typesafe.com/docs) for a complete list of supported databases, and to find a matching Slick driver. +Third, in the above configuration `slick.dbs.default.profile` is used to configure the Slick profile, while `slick.dbs.default.db.driver` is the underlying JDBC driver used by Slick's backend. In the above configuration we are configuring Slick to use H2 database, but Slick supports several other databases. Check the [Slick documentation](https://scala-slick.org/docs/) for a complete list of supported databases, and to find a matching Slick driver. Slick does not support the `DATABASE_URL` environment variable in the same way as the default Play JBDC connection pool. But starting in version 3.0.3, Slick provides a `DatabaseUrlDataSource` specifically for parsing the environment variable. @@ -72,7 +72,7 @@ slick.dbs.default.db.dataSourceClass = "slick.jdbc.DatabaseUrlDataSource" slick.dbs.default.db.properties.driver = "org.postgresql.Driver" ``` -On some platforms, such as Heroku, you may substitute the `JDBC_DATABASE_URL`, which is in the format `jdbc:vendor://host:port/db?args`, if it is available. For example: +On some platforms, such as Heroku, you may [substitute](https://github.com/lightbend/config/blob/master/HOCON.md#substitution-fallback-to-environment-variables) the `JDBC_DATABASE_URL` environment variable, which is in the format `jdbc:vendor://host:port/db?args`, if it is available. For example: ```conf slick.dbs.default.profile="slick.jdbc.PostgresProfile$" @@ -80,7 +80,7 @@ slick.dbs.default.db.driver="org.postgresql.Driver" slick.dbs.default.db.url=${JDBC_DATABASE_URL} ``` -> **Note**: Failing to provide a valid value for both `slick.dbs.default.driver` and `slick.dbs.default.db.driver` will lead to an exception when trying to run your Play application. +> **Note**: Failing to provide a valid value for both `slick.dbs.default.profile` and `slick.dbs.default.db.driver` will lead to an exception when trying to run your Play application. To configure several databases: diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md index 8558cccc..333796b4 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md @@ -4,11 +4,11 @@ With Slick 3 release, Slick starts and controls both a connection pool and a thread pool for optimal asynchronous execution of your database actions. -In Play Slick we have decided to let Slick be in control of creating and managing the connection pool (the default connection pool used by Slick 3 is [HikariCP](http://brettwooldridge.github.io/HikariCP/)), which means that to tune the connection pool you will need to look at the Slick ScalaDoc for [Database.forConfig](http://slick.typesafe.com/doc/3.1.0/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database) (make sure to expand the `forConfig` row in the doc). In fact, be aware that any value you may pass for setting the Play connection pool (e.g., under the key `play.db.default.hikaricp`) is simply not picked up by Slick, and hence effectively ignored. +In Play Slick we have decided to let Slick be in control of creating and managing the connection pool (the default connection pool used by Slick 3 is [HikariCP](https://github.com/brettwooldridge/HikariCP)), which means that to tune the connection pool you will need to look at the Slick ScalaDoc for [Database.forConfig](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) (make sure to expand the `forConfig` row in the doc). In fact, be aware that any value you may pass for setting the Play connection pool (e.g., under the key `play.db.default.hikaricp`) is simply not picked up by Slick, and hence effectively ignored. -Also, note that as stated in the [Slick documentation](http://slick.typesafe.com/doc/3.1.0/database.html#connection-pools), a reasonable default for the connection pool size is calculated from the thread pool size. In fact, you should only need to tune `numThreads` and `queueSize` in most cases, for each of your database configuration. +Also, note that as stated in the [Slick documentation](http://scala-slick.org/doc/3.3.2/database.html#connection-pools), a reasonable default for the connection pool size is calculated from the thread pool size. In fact, you should only need to tune `numThreads` and `queueSize` in most cases, for each of your database configuration. -Finally, it's worth mentioning that while Slick allows using a different connection pool than [HikariCP](http://brettwooldridge.github.io/HikariCP/) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](http://slick.typesafe.com/doc/3.1.0/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. +Finally, it's worth mentioning that while Slick allows using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](http://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. > **Note**: Changing the value of `play.db.pool` won't affect what connection pool Slick is using. Furthermore, be aware that any configuration under `play.db` is not considered by Play Slick. @@ -16,7 +16,7 @@ Finally, it's worth mentioning that while Slick allows using a different connect With Slick 3.0 release, Slick starts and controls both a thread pool and a connection pool for optimal asynchronous execution of your database actions. -For optimal execution, you may need to tune the `numThreads` and `queueSize` parameters, for each of your database configuration. Refer to the [Slick documentation](http://slick.typesafe.com/doc/3.1.0/database.html#database-thread-pool) for details. +For optimal execution, you may need to tune the `numThreads` and `queueSize` parameters, for each of your database configuration. Refer to the [Slick documentation](https://scala-slick.org/doc/3.3.2/database.html#database-thread-pool) for details. Since `3.2.2` of Slick, there is a requirement that `maxConnections = maxThreads` otherwise you might see these messages in your logs: @@ -25,7 +25,7 @@ Since `3.2.2` of Slick, there is a requirement that `maxConnections = maxThreads To fix this, simply set them in your config. For example, ``` -slick.dbs.default.driver="slick.driver.PostgresDriver$" +slick.dbs.default.profile="slick.profile.PostgresProfile$" slick.dbs.default.db.dataSourceClass="slick.jdbc.DatabaseUrlDataSource" slick.dbs.default.db.numThreads=20 slick.dbs.default.db.maxConnections=20 diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickFAQ.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickFAQ.md index 67cdcfee..31d911bd 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickFAQ.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickFAQ.md @@ -6,11 +6,11 @@ Have a look at the [compatibility matrix](https://github.com/playframework/play- ## `play.db.pool` is ignored -It's indeed the case. Changing the value of `play.db.pool` won't affect what connection pool Slick is going to use. The reason is simply that the Play Slick module currently doesn't support using a different connection pool than [HikariCP](http://brettwooldridge.github.io/HikariCP/). +It's indeed the case. Changing the value of `play.db.pool` won't affect what connection pool Slick is going to use. The reason is simply that the Play Slick module currently doesn't support using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP). ## Changing the connection pool used by Slick -While Slick allows using a different connection pool than [HikariCP](http://brettwooldridge.github.io/HikariCP/) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](http://slick.typesafe.com/doc/3.1.0/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. If you find yourself needing this feature, you can try to drop us a note on [our forums](https://discuss.lightbend.com/). +While Slick allows using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. If you find yourself needing this feature, you can try to drop us a note on [our forums](https://discuss.lightbend.com/). ## A binding to `play.api.db.DBApi` was already configured diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md index e5d061eb..c1f9f076 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md @@ -2,7 +2,7 @@ This is a guide for migrating from Play Slick v0.8 to v1.0, v1.1 or v2.0.0. -It assumes you have already migrated your project to use Play 2.5 (see [Play 2.5 Migration Guide](https://www.playframework.com/documentation/2.5.x/Migration25)), that you have read the [Slick 3.1 documentation](http://slick.typesafe.com/docs/), and are ready to migrate your Play application to use the new Slick Database I/O Actions API. +It assumes you have already migrated your project to use Play 2.5 (see [Play 2.5 Migration Guide](https://www.playframework.com/documentation/2.5.x/Migration25)), that you have read the [Slick 3.1 documentation](https://scala-slick.org/docs/), and are ready to migrate your Play application to use the new Slick Database I/O Actions API. ## Build changes @@ -80,7 +80,7 @@ db.$dbName.maxQueriesPerRequest slick.db.execution.context ``` -The parameter `db.$dbName.maxQueriesPerRequest` was used to limit the number of tasks queued in the thread pool. In Slick 3 you can reach similar results by tuning the configuration parameters `numThreads` and `queueSize`. Read the Slick ScalaDoc for [Database.forConfig](http://slick.typesafe.com/doc/3.1.0/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig(String,Config,Driver,ClassLoader):Database) (make sure to expand the `forConfig` row in the doc). +The parameter `db.$dbName.maxQueriesPerRequest` was used to limit the number of tasks queued in the thread pool. In Slick 3 you can reach similar results by tuning the configuration parameters `numThreads` and `queueSize`. Read the Slick ScalaDoc for [Database.forConfig](https://scala-slick.org/doc/3.1.0/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) (make sure to expand the `forConfig` row in the doc). While the parameter `slick.db.execution.context` was used to name the thread pools created by Play Slick. In Slick 3, each thread pool is named using the Slick database configuration path, i.e., if in your **`application.conf`** you have provided a Slick configuration for the database named `default`, then Slick will create a thread pool named `default` for executing the database action on the default database. Note that the name used for the thread pool is not configurable. diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala index 28ea1e2a..6ebd5b9a 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Typesafe Inc. + * Copyright (C) 2011-2019 Lightbend Inc. */ package scalaguide.slick package di diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala index cc0e3e7a..91ee9c3d 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2015 Typesafe Inc. + * Copyright (C) 2011-2019 Lightbend Inc. */ package scalaguide.slick package global diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala index 12ebbb57..e4374d4f 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2014 Typesafe Inc. + * Copyright (C) 2011-2019 Lightbend Inc. */ package scalaguide.slick From 0268be4afd82ceefc80bb2bcfee2331b81c912a8 Mon Sep 17 00:00:00 2001 From: Dominik Dorn Date: Fri, 14 Feb 2020 07:48:00 +1100 Subject: [PATCH 2/9] updated documentation for current version of play slick --- docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md index 4c3e003c..5ad31961 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md @@ -5,9 +5,11 @@ The Play Slick module makes [Slick](https://scala-slick.org/) a first-class citi - Integration of Slick into Play's application lifecycle. - Support for [[Play database evolutions|Evolutions]]. -Play Slick currently supports Slick 3.3 with Play 2.7 and Play 2.8, for Scala 2.12 and Scala 2.11. +Play Slick currently supports Slick 3.3 with Play 2.8, for Scala 2.12 and Scala 2.13. -> **Note**: This guide assumes you already know both Play 2.7 and Slick 3.3. +Previous versions support previous versions of Play! as well as Scala 2.11. + +> **Note**: This guide assumes you already know both Play 2.8 and Slick 3.3. ## Getting Help From 5668ca18c4475a2471fe6432257dab216e599111 Mon Sep 17 00:00:00 2001 From: Dominik Dorn Date: Thu, 13 Feb 2020 21:49:54 +0100 Subject: [PATCH 3/9] update slick.sbt to current version (cherry picked from commit 08d3df6d652e40f6228ba8e887953a146b1a272f) --- .../manual/working/scalaGuide/main/sql/slick/code/slick.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/slick.sbt b/docs/manual/working/scalaGuide/main/sql/slick/code/slick.sbt index b36e8872..2092f805 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/slick.sbt +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/slick.sbt @@ -1,10 +1,10 @@ // #add-library-dependencies -libraryDependencies += "com.typesafe.play" %% "play-slick" % "4.0.0" +libraryDependencies += "com.typesafe.play" %% "play-slick" % "5.0.0" // #add-library-dependencies // #add-dependency-with-evolutions libraryDependencies ++= Seq( - "com.typesafe.play" %% "play-slick" % "4.0.0", - "com.typesafe.play" %% "play-slick-evolutions" % "4.0.0" + "com.typesafe.play" %% "play-slick" % "5.0.0", + "com.typesafe.play" %% "play-slick-evolutions" % "5.0.0" ) // #add-dependency-with-evolutions From ef03ca56c06cad1bb17a6c519232d3d583d47ff4 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 20:35:22 -0800 Subject: [PATCH 4/9] Update docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md Co-Authored-By: Marcos Pereira (cherry picked from commit f32e0edfde630deeb0576447271b6390b1145878) --- docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md index 5ad31961..05fc0a73 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md @@ -60,7 +60,7 @@ slick.dbs.default.db.driver="org.h2.Driver" slick.dbs.default.db.url="jdbc:h2:mem:play" ``` -First, note that the above is a valid Slick configuration (for the complete list of configuration parameters that you can use to configure a database see the Slick ScalaDoc for [Database.forConfig](http://slick.typesafe.com/doc/3.3.2/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) - make sure to expand the `forConfig` row in the doc). +First, note that the above is a valid Slick configuration (for the complete list of configuration parameters that you can use to configure a database see the Slick ScalaDoc for [Database.forConfig](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) - make sure to expand the `forConfig` row in the doc). Second, the `slick.dbs` prefix before the database's name is configurable. In fact, you may change it by overriding the value of the configuration key `play.slick.db.config`. From 327c8adf22bcecf97091ae68ba06057cec914cf6 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 20:35:29 -0800 Subject: [PATCH 5/9] Update docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md Co-Authored-By: Marcos Pereira (cherry picked from commit c3710283453ee15e7891c40eba6cddb4d0b8216e) --- .../scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md index 333796b4..8b4d54f3 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md @@ -8,7 +8,7 @@ In Play Slick we have decided to let Slick be in control of creating and managin Also, note that as stated in the [Slick documentation](http://scala-slick.org/doc/3.3.2/database.html#connection-pools), a reasonable default for the connection pool size is calculated from the thread pool size. In fact, you should only need to tune `numThreads` and `queueSize` in most cases, for each of your database configuration. -Finally, it's worth mentioning that while Slick allows using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](http://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. +Finally, it's worth mentioning that while Slick allows using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. > **Note**: Changing the value of `play.db.pool` won't affect what connection pool Slick is using. Furthermore, be aware that any configuration under `play.db` is not considered by Play Slick. From 7de76d0a5ef38ff720fbd24307f49297de2d5762 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 20:38:59 -0800 Subject: [PATCH 6/9] Update docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md Co-Authored-By: Marcos Pereira (cherry picked from commit 861faab992404a985d2102b053474be6d488e0d2) --- .../scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md index 8b4d54f3..2c33f6f8 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickAdvancedTopics.md @@ -6,7 +6,7 @@ With Slick 3 release, Slick starts and controls both a connection pool and a thr In Play Slick we have decided to let Slick be in control of creating and managing the connection pool (the default connection pool used by Slick 3 is [HikariCP](https://github.com/brettwooldridge/HikariCP)), which means that to tune the connection pool you will need to look at the Slick ScalaDoc for [Database.forConfig](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcBackend$DatabaseFactoryDef@forConfig%28path:String,config:com.typesafe.config.Config,driver:java.sql.Driver,classLoader:ClassLoader%29:JdbcBackend.this.Database) (make sure to expand the `forConfig` row in the doc). In fact, be aware that any value you may pass for setting the Play connection pool (e.g., under the key `play.db.default.hikaricp`) is simply not picked up by Slick, and hence effectively ignored. -Also, note that as stated in the [Slick documentation](http://scala-slick.org/doc/3.3.2/database.html#connection-pools), a reasonable default for the connection pool size is calculated from the thread pool size. In fact, you should only need to tune `numThreads` and `queueSize` in most cases, for each of your database configuration. +Also, note that as stated in the [Slick documentation](https://scala-slick.org/doc/3.3.2/database.html#connection-pools), a reasonable default for the connection pool size is calculated from the thread pool size. In fact, you should only need to tune `numThreads` and `queueSize` in most cases, for each of your database configurations. Finally, it's worth mentioning that while Slick allows using a different connection pool than [HikariCP](https://github.com/brettwooldridge/HikariCP) (though, Slick currently only offers built-in support for HikariCP, and requires you to provide an implementation of [JdbcDataSourceFactory](https://scala-slick.org/doc/3.3.2/api/index.html#slick.jdbc.JdbcDataSourceFactory) if you want to use a different connection pool), Play Slick currently doesn't allow using a different connection pool than HikariCP. From d18b407e313c810f8052dbcf80e590db356e369b Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 20:39:49 -0800 Subject: [PATCH 7/9] Update headers (cherry picked from commit b03335130a59cadf08956f22ba1c1702301e9e32) --- docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala | 2 +- .../manual/working/scalaGuide/main/sql/slick/code/Example.scala | 2 +- .../working/scalaGuide/main/sql/slick/code/UsersSchema.scala | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala index 6ebd5b9a..d4c9e42c 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/DI.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2019 Lightbend Inc. + * Copyright (C) Lightbend Inc. */ package scalaguide.slick package di diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala index 91ee9c3d..4479304b 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/Example.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2019 Lightbend Inc. + * Copyright (C) Lightbend Inc. */ package scalaguide.slick package global diff --git a/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala b/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala index e4374d4f..111e0461 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala +++ b/docs/manual/working/scalaGuide/main/sql/slick/code/UsersSchema.scala @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011-2019 Lightbend Inc. + * Copyright (C) Lightbend Inc. */ package scalaguide.slick From 17ce1ddc0cc23669fbe44e7da23a45389c1fd638 Mon Sep 17 00:00:00 2001 From: Will Sargent Date: Thu, 13 Feb 2020 20:43:31 -0800 Subject: [PATCH 8/9] Make migration guide intro more coherent (cherry picked from commit f9f06d5a0318cb95ee820ea9cb9f6521d72894cd) --- .../scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md index c1f9f076..b6ff60d2 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlickMigrationGuide.md @@ -1,8 +1,8 @@ # Play Slick Migration Guide -This is a guide for migrating from Play Slick v0.8 to v1.0, v1.1 or v2.0.0. +This is a guide for migrating from Play Slick to a version that supports the new Slick 3.0 APIs. -It assumes you have already migrated your project to use Play 2.5 (see [Play 2.5 Migration Guide](https://www.playframework.com/documentation/2.5.x/Migration25)), that you have read the [Slick 3.1 documentation](https://scala-slick.org/docs/), and are ready to migrate your Play application to use the new Slick Database I/O Actions API. +It assumes you have already migrated your project to use Play 2.5 (see [Play 2.5 Migration Guide](https://www.playframework.com/documentation/2.5.x/Migration25)), that you have read the [Slick documentation](https://scala-slick.org/docs/), and are ready to migrate your Play application to use the new Slick Database I/O Actions API. ## Build changes @@ -24,7 +24,7 @@ While, if you are not using evolutions, you can now safely remove `evolutionplug ## Database configuration -With the past releases of Slick Play (which used Slick 2.1 or earlier), you used to configure Slick datasources exactly like you would configure Play JDBC datasources. This is no longer the case, and the following configuration will now be **ignored** by Play Slick: +With the past releases of Play Slick (which used Slick 2.1 or earlier), you used to configure Slick datasources exactly like you would configure Play JDBC datasources. This is no longer the case, and the following configuration will now be **ignored** by Play Slick: ```conf db.default.driver=org.h2.Driver @@ -38,7 +38,7 @@ There are several reasons for this change. First, the above is not a valid Slick Here is how you would need to migrate the above configuration: ```conf -slick.dbs.default.driver="slick.driver.H2Driver$" # You must provide the required Slick driver! +slick.dbs.default.profile="slick.jdbc.H2Profile$" # You must provide the required Slick profile! slick.dbs.default.db.driver=org.h2.Driver slick.dbs.default.db.url="jdbc:h2:mem:play" slick.dbs.default.db.user=sa From 8b97829c73068ffa41f81dfdf3dbeeaf39680399 Mon Sep 17 00:00:00 2001 From: Max Rosenbaum Date: Thu, 20 Jan 2022 00:30:20 +1100 Subject: [PATCH 9/9] Set play-slick h2 version in docs --- docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md index 05fc0a73..2b6e070a 100644 --- a/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md +++ b/docs/manual/working/scalaGuide/main/sql/slick/PlaySlick.md @@ -46,7 +46,8 @@ Note there is no need to add the Play `evolutions` component to your dependencie The Play Slick module does not bundle any JDBC driver. Hence, you will need to explicitly add the JDBC driver(s) you want to use in your application. For instance, if you would like to use an in-memory database such as H2, you will have to add a dependency to it: ```scala -"com.h2database" % "h2" % "${H2_VERSION}" // replace `${H2_VERSION}` with an actual version number +// play-slick 5.0.x is currently built and tested against version 1.4.200 +"com.h2database" % "h2" % "1.4.200" ``` ## Database Configuration