Sitelet https://github.com/tminglei/slick-pg/pull/825
Skip to content

Slick v4 migration - #825

Draft
hvesalai wants to merge 6 commits into
tminglei:masterfrom
hvesalai:slick-v4-migration
Draft

hvesalai wants to merge 6 commits into
tminglei:masterfrom
hvesalai:slick-v4-migration

Conversation

@hvesalai

Copy link
Copy Markdown

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.sbt

  • Slick updated from 3.6.1 to 4.0.0
  • Added slick-future, cats-effect, and fs2-core dependencies (required by the slick-future module)
  • Scala 3 updated from 3.3.1 to 3.8.3; cross-compilation retained for 2.12, 2.13 and 3
  • play-json dependency simplified: the Scala-version conditional is no longer needed since org.playframework supports all three versions

Core library

  • ExPostgresProfile: createModelBuilder and ExModelBuilder no longer take an implicit ExecutionContext parameter, which was removed from the Slick v4 signature.
  • lobj/LargeObjectStreamingDBIOAction: Replaced the Slick v3 emitStream/cancelStream pair (along with StreamState, implicit proof, and the 5-type-parameter SynchronousDatabaseAction) with the new Slick v4 openStream returning a CloseableIterator[Array[Byte]].
  • date/PgDateJdbcTypes: The mapTo helper's explicit implicit argument passing (ctag, this) to MappedJdbcType.base was replaced with implicit val self brought into scope. This is required for Scala 3 compatibility, where context bounds map to using parameters and can no longer be satisfied with explicit argument syntax.

Test infrastructure

  • PostgresContainer: db is no longer a lazy val defined per test class. It is now a lifecycle-managed shared resource — opened in afterStart() using slick.future.Database (from the new slick-future module) and closed in beforeStop(). Test suites continue to use Await.result(db.run(...), Duration.Inf) unchanged.
  • ScalaVersionShim (scala-2 / scala-3): WeekDay type converters for PgCompositeSupportSuite moved from an inline Scala-2-only block into version-specific shims. This is required for Scala 3 compatibility, where register() 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(/sitelet?url=https%3A%2F%2Fgithub.com%2Ftminglei%2Fslick-pg%2Fpull%2F...), which is now provided by PostgresContainer. All other test code is unchanged — Await.result(db.run(...), Duration.Inf) continues to work as before thanks to slick.future.Database providing the same run/stream API as Slick 3.

@hvesalai
hvesalai marked this pull request as draft April 21, 2026 12:18
@hvesalai

Copy link
Copy Markdown
Author

Ping @tminglei can you check out this PR in preparation for the upcoming slick 4.

@hvesalai

hvesalai commented May 8, 2026

Copy link
Copy Markdown
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.

hvesalai and others added 5 commits July 15, 2026 11:02
Add an explicit result type to the protected implicit `b1Type`
(inferred slick.ast.TypedType[String]), as required by Scala 2.13's
lint rules.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- organization: com.github.tminglei -> com.typesafe.slick; POM url/scm
  point to github.com/slick/slick-pg
- version: open the Slick 4 series at 0.24.0, now derived from git tags
  via sbt-dynver (removed the hardcoded version)
- release: adopt sbt-ci-release (matching slick/slick), set
  sonatypeProfileName := "com.typesafe.slick"
- CI: modernize workflow (checkout@v6, setup-java@v5, sbt/setup-sbt@v1,
  fetch-depth 0 for dynver), fix Scala 3 matrix to 3.8.3, baseline Java
  at 17, add a tag-triggered `sbt ci-release` publish job
- README: update dependency coordinates, version, and Slick version

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the README's source/test browsing links (and the issue link)
from the upstream tminglei repo to the slick org fork.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Link to the official Scala Discord #slick channel, matching the badge
used by the main slick/slick repo. The existing gitter link is kept.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hvesalai
hvesalai force-pushed the slick-v4-migration branch from bbfd273 to bb6ac24 Compare July 15, 2026 09:18
@hvesalai hvesalai closed this Jul 15, 2026
@hvesalai hvesalai reopened this Aug 25, 2026
@hvesalai

Copy link
Copy Markdown
Author

@tminglei could you get in touch with me ASAP. We need to get this forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant