Slick v4 migration#825
Draft
hvesalai wants to merge 1 commit into
Draft
Conversation
Author
|
Ping @tminglei can you check out this PR in preparation for the upcoming slick 4. |
Author
|
@tminglei have you had time to review this? I tried to contact you by email to agree on synchronizing the slick and slick-pg releases for slick4 support. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a bit early, but I'm working with releasing Slick 4 and would like to present this PR to show the kind of chanages needed to downstream libraries extending Slick (which I don't know many). The version referred to by the PR does not exist publicly. I will update the PR once it does.
This PR migrates slick-pg to Slick v4. The changes are straightforward and mostly limited to how tests obtain a database connection — the library code itself has only minor updates.
Changes
build.sbt3.6.1to4.0.0slick-future,cats-effect, andfs2-coredependencies (required by theslick-futuremodule)3.3.1to3.8.3; cross-compilation retained for 2.12, 2.13 and 3play-jsondependency simplified: the Scala-version conditional is no longer needed sinceorg.playframeworksupports all three versionsCore library
ExPostgresProfile:createModelBuilderandExModelBuilderno longer take an implicitExecutionContextparameter, which was removed from the Slick v4 signature.lobj/LargeObjectStreamingDBIOAction: Replaced the Slick v3emitStream/cancelStreampair (along withStreamState,implicit proof, and the 5-type-parameterSynchronousDatabaseAction) with the new Slick v4openStreamreturning aCloseableIterator[Array[Byte]].date/PgDateJdbcTypes: ThemapTohelper's explicit implicit argument passing(ctag, this)toMappedJdbcType.basewas replaced withimplicit val selfbrought into scope. This is required for Scala 3 compatibility, where context bounds map tousingparameters and can no longer be satisfied with explicit argument syntax.Test infrastructure
PostgresContainer:dbis no longer alazy valdefined per test class. It is now a lifecycle-managed shared resource — opened inafterStart()usingslick.future.Database(from the newslick-futuremodule) and closed inbeforeStop(). Test suites continue to useAwait.result(db.run(...), Duration.Inf)unchanged.ScalaVersionShim(scala-2 / scala-3):WeekDaytype converters forPgCompositeSupportSuitemoved from an inline Scala-2-only block into version-specific shims. This is required for Scala 3 compatibility, whereregister()relies on implicit resolution and cannot be called with the same syntax as in Scala 2.All test suites
Uniform mechanical change across every test suite: removed
lazy val db = Database.forURL(...), which is now provided byPostgresContainer. All other test code is unchanged —Await.result(db.run(...), Duration.Inf)continues to work as before thanks toslick.future.Databaseproviding the samerun/streamAPI as Slick 3.